hi, i'm a student, currently doing a design project that build a communication link that can carry digitized voice across a room using PIC18f452 microcontrollers and modulated infrared light.
since i'm new to pic world, i do hope to get help from you pro here... thanks first...
i've done with the LED blinking for the PIC... works properly... does anyone know where to download the program that converts .c file to .hex?
does anyone did something similiar? pls give me an idea how this can be done...
is there any tutorials for pic programming? preferably teaching in c language...
What you are looking for is a compiler. It reads your C source code and produces binary object code that the PIC can understand and execute.
I know Microchip has the C18 compiler, but it isn't free. I don't know if there is an educational free version available. C coders will surely chime in.
But are you sure you want to use the C language for your PIC programming? I'm not saying it is a bad choice. It's a very good choice if you are going to work on large firmware projects, for instance.
But I'm saying there is an alternative called assembly language. MPLAB includes MPASM which will assemble (compile if you prefer) your assembly source into a hex file. And this is completely free.
hi, i'm a student, currently doing a design project that build a communication link that can carry digitized voice across a room using PIC18f452 microcontrollers and modulated infrared light.
Make sure you visit http://www.piclist.com. There are lots of projects posted there and you might find something similar, or at least a small IR project that'll get you started.
i've downloaded mplab ide and microchip's C18 compiler as well... i did some reading on the datasheets and user guide , trying for the examples also... i just can't get a clear image of what am i doing... for example, i try to communicate my PIC with PC by hyperterminal through a MAX232 chip... but it just seems like not working...
Joel, i prefer to use c language is because i know c more than assembly... this project due within 4 weeks... so i don't think i have time for a new language but many of the tutorial sites are assembly language, i wonder should i learn that?
Joel, btw, after compile the .c source code, the binary object code should appear in the folder, is it? then, should i transfer the binary object code file to the PIC using picstart plus? or how should i download the c source code to PIC?
The PIC doesn't read or speak the C language. You on the other hand only speak C. The PIC only understands object code (the hex file). The C18 compiler is the translator here. It understands C code and outputs object code that the PIC will understand.
Picstart Plus contains the basic circuitry that allows you to write the hex file to your PIC. Once you get MPLAB/C18 to compile your source correctly, you tell MPLAB to transfer the hex file to your PIC through the Picstart Plus programmer.
Joel, i prefer to use c language is because i know c more than assembly... this project due within 4 weeks... so i don't think i have time for a new language but many of the tutorial sites are assembly language, i wonder should i learn that?
I wouldn't bother with assembly language, not for this project. Learning assembly is a project in itself, and you already have a cool project on your hands, so leave asm aside for now. Use C.
You definitelly need to know Assembly programming. Without it (as stated in the Sticky) you can't produce very complicated designs (and your design will require some Assembly skills). Assembly is NOT hard, it will take you 2~3 days to understand it (atleast I did).
The PIC doesn't read or speak the C language. You on the other hand only speak C. The PIC only understands object code (the hex file). The C18 compiler is the translator here. It understands C code and outputs object code that the PIC will understand.
Picstart Plus contains the basic circuitry that allows you to write the hex file to your PIC. Once you get MPLAB/C18 to compile your source correctly, you tell MPLAB to transfer the hex file to your PIC through the Picstart Plus programmer.
i've downloaded mplab ide and microchip's C18 compiler as well... i did some reading on the datasheets and user guide , trying for the examples also... i just can't get a clear image of what am i doing... for example, i try to communicate my PIC with PC by hyperterminal through a MAX232 chip... but it just seems like not working...
Have you programmed the PIC to read from RS232?, if it's just a blank PIC how do you expect it to work?.
Joel, i prefer to use c language is because i know c more than assembly... this project due within 4 weeks... so i don't think i have time for a new language but many of the tutorial sites are assembly language, i wonder should i learn that?
My opinion is that you can't program a PIC effectively in C, UNLESS you have a reasonable working knowledge of assembler - you don't need to be a master at it, but no knowledge at all cripples your C programming capabilities.
If your project is due in four weeks?, I think you're in deep s**t - starting from zero knowledge of PIC's you've got a LOT! to do.
For a start have you got your design figured out?, what is your sampling rate for the audio?, and have you confirmed you can transfer the data fast enough over your IR link?. There are a number of seperate design problems, probably the most difficult is the IR link?, there's plenty of cheap and easy low speed IR bits available (for remote control), but for this you might have to build all your own from scratch!.
Joel, btw, after compile the .c source code, the binary object code should appear in the folder, is it? then, should i transfer the binary object code file to the PIC using picstart plus? or how should i download the c source code to PIC?
The compiler produces a HEX file, you then transfer this to the PIC using the PICStart Plus (or other programmer). If you're using MPLAB and C18, this process might be automatic?, I don't know as I don't use either!.
I would say that asm would seem daunting to a beginner. Certain aspects like interrupt handling and architecture, may not seem obvious to a first-timer. The fastest way is to have someone to guide you. But after you get the hang of it, you will realise that asm instructions are really simple, in fact, they are so simple you need a bunch of them to form a simple C statement.
You definitelly need to know Assembly programming. Without it (as stated in the Sticky) you can't produce very complicated designs (and your design will require some Assembly skills). Assembly is NOT hard, it will take you 2~3 days to understand it (atleast I did).
You definitelly need to know Assembly programming. Without it (as stated in the Sticky) you can't produce very complicated designs (and your design will require some Assembly skills). Assembly is NOT hard, it will take you 2~3 days to understand it (atleast I did).
Actually I don't know, I never needed one...
But I guess Nigels tutorials explain such things.
BTW: PICs process Instructions, not Commands (Command is a High level expression containing more instructions). PICs datasheet has everything necessary to start programming from scratch.
I would say that asm would seem daunting to a beginner. Certain aspects like interrupt handling and architecture, may not seem obvious to a first-timer.
In fact, the real struggle for someone trying out ASM for the first time (and who only knows a high level language) is when you realize that a statement like
Code:
if (count == 18)
requires a bitwise operation. In fact, almost every "if" statement in C translates to a bitwise operation and a bit test in ASM.