Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

searching for help...

Status
Not open for further replies.

hhyong99

New Member
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...

thanks a million...
 
You can download a free 'student edition' of microchip's C18.
A very good C compiler for PIC18's...

The student edition is unlimited, only some optimizing routines can only be used for 60 days...

As for learning C, You can find a lot of internet sites wich explain C.
 
hhyong99 said:
does anyone know where to download the program that converts .c file to .hex?

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.
 
Exo said:
You can download a free 'student edition' of microchip's C18.
A very good C compiler for PIC18's...

The student edition is unlimited

Well, ok, my point about MPASM being completely free compared to C18 is out the window. You should never listen to me anyway. :p

Get the C18 compiler, and start moving stuff in and out of W. (Read your PIC's datasheet if you don't get that last part)
 
hhyong99 said:
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.

That sounds like a cool project by the way.

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.
 
thanks Exo and Joel...

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?
 
hhyong99 said:
should i transfer the binary object code file to the PIC using picstart plus?

Yes, that's the only way to go about it.

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.
 
hhyong99 said:
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). :D
 
Yes, that's the only way to go about it.

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.


yo, thanks Joel, found that :)
 
hhyong99 said:
thanks Exo and Joel...

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.
 
Jay.slovak said:
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). :D

haha, Jay, you are really god...

question: does the tutorial teach the usage of a command, like movwf (is this a command)?
 
Jay.slovak said:
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). :D

u only took 3 days ?? how did u learn it ?? i too need to learn it fast ..
 
hhyong99 said:
question: does the tutorial teach the usage of a command, like movwf (is this a command)?
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.
 
checkmate said:
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.
 
hhyong99 said:
haha, Jay, you are really god...
question: does the tutorial teach the usage of a command, like movwf (is this a command)?
I'll teach you something better. It's called reading the datasheets. Try interpreting what the datasheet says for movwf.
 

Attachments

  • movwf.jpg
    movwf.jpg
    31 KB · Views: 734
kupikupi said:
u only took 3 days ?? how did u learn it ?? i too need to learn it fast ..
Well if you really want to know something, nothing can stop you. And I wanted to know MCUs so bad :lol:
 
checkmate said:
hhyong99 said:
haha, Jay, you are really god...
question: does the tutorial teach the usage of a command, like movwf (is this a command)?
I'll teach you something better. It's called reading the datasheets. Try interpreting what the datasheet says for movwf.
That's what I am talking about!
 
Status
Not open for further replies.

Latest threads

Back
Top