Page 1 of 1

Problem c lang convert to hex (help)

PostPosted: Mon Sep 06, 2010 9:51 pm
by p4can_lusuh
i wrote a program in c language to control servo movement but i don't know how to convert it to hex file. :(

Re: Problem c lang convert to hex (help)

PostPosted: Tue Sep 07, 2010 9:26 am
by hyng
http://www.cytron.com.my/usr_attachment ... ct_16F.pdf

please refer to the doc. The hex code will be auto generated at the project folder after you have successfully built it.

Re: Problem c lang convert to hex (help)

PostPosted: Tue Sep 07, 2010 3:26 pm
by p4can_lusuh
HI..thanx for reply.
but still have problem guys.. i copy down the sample code and compile it . but what i found is that the hex file created is no same as the download from the folder hex file . and thus is no working . but if i load the sample hex file to PIC . it work. so what is the problem ? with the sample code SC16A+16F, im using MPLAB IDE v8.30 with HITECH C compiler. is it problem cm from MPLAB version for sk40c?

Re: Problem c lang convert to hex (help)

PostPosted: Wed Sep 08, 2010 12:21 pm
by hyng
p4can_lusuh WROTE:HI..thanx for reply.
but still have problem guys.. i copy down the sample code and compile it . but what i found is that the hex file created is no same as the download from the folder hex file . and thus is no working . but if i load the sample hex file to PIC . it work. so what is the problem ? with the sample code SC16A+16F, im using MPLAB IDE v8.30 with HITECH C compiler. is it problem cm from MPLAB version for sk40c?


Sorry for the trouble caused. The setting of UART baudrate in the C code is for 10Mhz crystal (it has been commented in the code) while the hex code is for 20Mhz crystal. What you have to do is just replace the SPBRG value (0x40 / 64 in decimal) with 129. Anyway, i have updated the code with 20Mhz setting at the product page. You may download it again.

Re: Problem c lang convert to hex (help)

PostPosted: Wed Sep 22, 2010 5:35 am
by p4can_lusuh
Sorry for the trouble caused. The setting of UART baudrate in the C code is for 10Mhz cystal (it has been commented in the code) while the hex code is for 20Mhz crystal. What you have to do is just replace the SPBRG value (0x40 / 64 in decimal) with 129. Anyway, i have updated the code with 20Mhz setting at the product page. You may download it again.


hai guys..
desperate for this to my final project. :D
now i know what is SPBRG value. it really help..thanx!