Forum Replies Created
-
AuthorPosts
-
faizalParticipant
First you need to know what pic you’re going to use. Register organization differs for each pic. I have used three compilers for pic18, and i’d say none is superior to the other. Each have its own weakness, and each have their own advantage. To me, the key is understanding the built-in function of the compiler you’re going to use, and the datasheet of the pic you have in mind. Mplab has its own debugging tools. Mikroc has its own debugging tool. I usually use proteus because i can simulate and stimulate the pic, and the register operation is still viewable. If you want to switch to mikroc, this could be a headstart:
http://www.engineersgarage.com/tutorials/mikroc-pic-programming-tutorial
But c18/hitech-c is also very powerful. So, you have to decide by yourself.
As for the hex file, when you build your c program, a hex file is automatically generated in the folder you specify your project. The next step is to test the hex file; simulate or burn to pic.
faizalParticipant1) upload your code/pseudocode and schematics and we might be able to see the problem.(I wont promise anything)
2) break your problem into pieces. remember divide and conquer? knowing what you are trying to do is the key. you said the program is not working, but what is not working? usart communication? unresponsive gsm modem? lcd not displaying? inverted max232 output? crazy output?
3)after you have identified the problem look into them one by one. For example:
if you suspect its with eusart->check with hyperterminal, if you transmit a test string, was it displayed on the terminal? check your baud rate
if you suspect its with gsm-> test with some command e.g AT?, does it return OK, check your modem operational baud rate
if you suspect its with lcd-> check if you can display any test string.
Disable all the other functions, and test just one function at a time to see if its working. Don’t expect anyone to give codes to you straight away. this is a forum for engineers, future engineers and hobbyist. Think like an engineer. we gather here to work on problems. Don’t just say you have problems. Identify the problems and tell us what it is
Have a nice day
faizalParticipantif your output is at the hyperterminal:
1) check com port baud rate
2) check if the port you’re trying to connect is being used by other program.
3) check if your config bits is applied in the project setting
if you have access to oscilloscope:
1) probe the tx pin if its tranmitting
i have tested above code, and its working.
if its too hard, consider using the following built in function for mikroc:
char string[20]; //put any size here
int i=0;
USART_init(9600); //set baud rate, built in
for(i=0;i<sizeof(string);i++)
{
USART_Write(string); //transmit each character one by one
}
USART_Write(0x0d); //put a carriage return after finishing transmission
hope this help
faizalParticipant1) check your pic baud rate
2) connect your pic tx pin to pc via max232.
3) send test string to hyperterminal. e.g: USART_Write(“test”) for mikroc
faizalParticipantif you’re looking for guide, this guide is already good enough:
http://www.engineersgarage.com/embedded/pic-microcontroller-projects/timer-circuit
faizalParticipanti think you can use the pic project in this website. connect the sensor to analog pins and use Adc_read() in MikroC. since you want to produce an analog output, i think you can use the digital I/O pins connected to Digital-to-analog circuits. and the output can be connected to the transmitter.
just my theory
if its wrong, correct me and don’t be mad. i’m just trying to help
February 13, 2012 at 2:15 am in reply to: How to burn the C program in a single PIC controller #7156faizalParticipanthex burning
pic16- you can use winpic800
pic18- you can use pickit2
c compiler(hex generator)
pic16-unsure
pic18-mplab c18
-hi-tech c
-mikro c
-these are the ones i’m using right now
simulator (if you’re afraid to make everything burst into flames)
proteus-expensive but worth it. you can generate the corresponding pcb circuit afterwards. good track routing
oshon
tina
the names keep getting weirder.
have a nice day
faizalParticipantI think i have replied to this topic before. I wonder why its not showing up
anyway, i think the code is written for Mikro c, not c18.
if you’re using c18, there is a header file called “lcd.h”. this is where you set the required lcd pins.
use correct pragma directives for the configuration bits, oscillator,prescaler,wdt etc…
if you’re using MikroC, set the configuration bits in “project-> edit project”. the configuration bits are in the given code(commented). i’ve tested this code in MikroC and it works fine displaying on the lcd except for some glitches at the beginning.I use a 20Mhz crystal so i have to change the config bits. I add a 100ms delay at the beginning of my main() to overcome this.
pls correct me if i’m wrong and have a nice day
February 13, 2012 at 1:27 am in reply to: Temperature Sensor : Interfacing LM35 and LCD Display to PIC18F4550 #7154faizalParticipanti use c18 “long time” ago. if i’m not mistaken, itoa() is a built in function in c18. you can use this to convert the integer to string straight away.
have a nice day
-
AuthorPosts