Asked for some help regarding a pic to pc communication using rs232 and serial port a few weeks ago.
Manged to get all my components ordered and finished building the thing last week, now for my one true hate, programming! Need to send a worded message through the USART function of the PIC16F88.
I know what I want my pic to do, but I can only say it like this, have no idea how to put into a code.....
Check pins 1, 2 and 3.
If pin 1 = 0
and pin 2 = 1
and pin 3 = 1
send string "FAIL" to pin 11
Thats basically it although I know it will take a bit more than that. The same procedure will be repeated about 5 times for various '1' and '0' combinations.
Please, please can someone help me bring this into some kind of code.
The main things I need to know are:-
1 - What kind of program do I make the code in? (mikroC)
2- What information do i need to do this? (port numbers etc.)
3- How long will the code be/what functions should i use?
4- What program do I use to convert and download the program to the pic?
Thanks for your help, I have been directed to online tutorials before but they arent much use to me because i just simply dont understand the code and what its doin!
The 16F88 is a real old chip and a pain to use. I did, however, write UART code in HI-TECH C (should work without problems in mikro C) for the 16F886 (should work on 16F88). The code is very simple and makes use of the hardware UART module in the 16F886.
1. Does your chip have a hardware UART? Or does this need to be implemented in software?
2. You can use HI-TECH C compiler (I recommend this over any other compiler for the 16F series, it's the best compiler out there for this series of PIC microchip).
3. As for the code/functions, it's VERY easy if you have a hardware UART in your microcontroller. If not, then things will get messy.
4. Do you have a PIC programmer device? I recommend the PICKIT2. If you buy that, you don't even need the MAX232. All you do with the PICKIT2 is hook it up directly to the PIC's UART lines and you can use UART that way. With the PICKIT2, you can use the PICKIT2 software. If you're not using the PICKIT2, then there are a lot of programmer devices and software you can use. Again, I HIGHLY recommend you go and buy the PICKIT2 if you don't have it already.
And I understand that it can be frustrating when you ask for help and all you get are links to lame tutorials. Let's see if I can be of any help.
Manged to get all my components ordered and finished building the thing last week, now for my one true hate, programming! Need to send a worded message through the USART function of the PIC16F88.
I know what I want my pic to do, but I can only say it like this, have no idea how to put into a code.....
If you keep that attitude towards programming you are going to be asking other people to program for you, for the rest of your life.
My advice would be, bite the bullet and study and learn how to do simple programming.
Its pointless building a MCU hardware project if you havn't a clue on how to program it.!
I agree! Thats what I am doing right now, learning MCC, writing my program to fit the Junebug to get it going, then I will change it for the final project. I want to collect adc and port data and send it out the USART. I am not sure yet if I will do a timed cycle or ask for it via the USART then send. There are so many examples out there to learn from.
After the first couple it will get easier. I am picking this up after 20 years of no programming.
Start plugging and good luck.
ike
There is no hardware buffer on the pic chips there is only a holding register which must be read before the next byte arrives. You have to implement a buffer in software.
i need to send the hex data '1E' from pic 18f 4550 to another device through usart ...?? what is the corresponding character for '1E' ... how to do that in C18 ?