Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
LinkBack Thread Tools Display Modes
Old 14th April 2005, 08:59 PM   (permalink)
Default Help on how to program chip...

I want to program the chip to control some inputs and outputs with the pic18f452, i will be using the usart for serial commnication but how do I acitvate or use the ports to control electronic devices.

I know you need to enable the usart and the RC6/RC7 pins but I have know idea how to use the usart to control the selected ports for I/O.

Thankyou for looking and any help or asm program would greatly be appreciated and credited.....thanks again.
teknyc78 is offline  
Old 14th April 2005, 09:44 PM   (permalink)
Default

You first need to decide on how YOU want to send the control signals, once you have decided on a protocol you can then implement it in code.

Your PIC program needs to receive the data from the PC, either one byte or multiple bytes (depending on your protocol), then check what the data tells it to do, and perform that function.

For a very simple example, you could use single ASCII characters to set specific pins high or low - so, say 'A' means set pin a0 high, and 'a' means set it low - your program needs to take the received character from the USART and compare it to a series of valid characters, branching accordingly. If it receives a non-valid character, you could either discard it, or have some kind of error indication.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline  
Old 14th April 2005, 09:55 PM   (permalink)
Default

i would say binary codes, is this valid in controlling the ports.......the usart is in portC and the port I want to use is portB......have any suggestions?
thanks for replying quick......this is the best site....that I came across so far.....
teknyc78 is offline  
Old 14th April 2005, 10:08 PM   (permalink)
Default

Quote:
Originally Posted by teknyc78
i would say binary codes, is this valid in controlling the ports.......the usart is in portC and the port I want to use is portB......have any suggestions?
Anything is valid, it's just a question of writing it!. But I don't really understand what you mean by 'binary codes'?.

It doesn't make any difference what port you use, you simply write the code accordingly.

I would suggest though, that you've picked a bad PIC for your level of experience, the 18F is a 'top range' device, as such it's more powerful and consequently more complicated than the 16F 'mid range' series.

If you have a look at my RS232 PIC tutorials it might help you somewhat?.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline  
Old 14th April 2005, 10:34 PM   (permalink)
Default

any pic16 in particular?
teknyc78 is offline  
Old 15th April 2005, 08:58 AM   (permalink)
Default

Quote:
Originally Posted by teknyc78
any pic16 in particular?
My tutorials mostly use the 16F628, which is a good choice to learn on, it would also easily do everything your application requires.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline  
Reply

Bookmarks

Thread Tools
Display Modes





All times are GMT. The time now is 12:15 AM.


Electronic Circuits  |  Learning Electronics
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.

eXTReMe Tracker