greetings
i'm really stuck now. i'm making a bootloader for my PIC and i can't really tell what is wrong with my simple line of codes.
counter = 1;
for (counter = 1 ; counter <= linelength ; counter++)
{ output_b(counter);
GetAndBurn(counter);
if (transmissionflag = 0) break; else;
if (counter == 1)
checksum = (blockaddress*2) + (linelength*2) + byte1 + byte2; //adding linelength and base address into the checksum
else
checksum = checksum + byte1 + byte2; //adding the rest of the bytes
}
//output_b(0x0F);
transmittedchecksum = timed_receive();
// delay_ms(3000);
// putc('F');
// output_b(0x10);
if (transmissionflag == 0) break; else;
// output_b(0x30);
checksum = checksum + transmittedchecksum; //adding the checksum byte
// output_b(checksum);
// delay_ms(3000);
while(checksum >= 256) checksum = checksum - 256; //removing carry bit
// output_b(0xF0);
// output_b(checksum);
// delay_ms(3000);
if (checksum == 0)
{
// output_b(0x0F);
putc(84); //successful transmission of one line, send a 'T' representing TRUE
// delay_ms(3000);
}
else
{
//output_b(0xF0);
putc(70) ; //bad checksum - send an 'F', representing FALSE, to destroy the whole cycle
i managed to get the checksum to be true, but somehow the thing doesnt output a "T" through RS-232. all the things commented out are my way of checking which part of the cycle the thing is in. In my VB program, to verify the writing of that line, i first send the CheckSum value to the PIC,
transmittedchecksum = timed_receive();
and then my VB program wait for T or F from the PIC before deciding what to do. The checksum appears to be correct since i can get into the part where checksum = 0 and output_b(0x0F). i assume the entire loop and checksum cycle is OK I feel its the freakiin putc("T")*changed to putc(84) as i ran out of ideas* .. it keeps sending a "" to my VB.
my VB program also has a timed_receive kinda thing, and the loop breaks, indicating there is transmission, but then there is no character seen. if the program doesnt receive anything, a different message box would appear(something that says "Timed out").
can someone help? its getting really frustrating getting stuck at this level.