Subscribe
 


Control a PIC 16F628 using a serial 4800 baud terminal



Control a PIC 16F628 using a serial 4800 baud terminal
Here is some code to allow you to use a serial terminal to read and write to the PIC's registers and EEPROM.

; SERIAL PORT CONTROL:
;
;	PORT A0 is Serial input
;	PORT A0 is serial output
;
;	usb gmus-03 USB Serial Adapter
;
;	TX  D9 Pin 3 -[4k7]----+-----PA0
;	RX  D9 Pin 2 ----------/
;
;	GND D9 Pin 5 ---------------- 0V

The ; executes the command. There needs to be a delay between each character sent to allow the PIC to process the commands. Do not use spaces and the command letter must be in column1. The PIC buffers the characters, and uses the last buffered characters. The buffer length is checked. Connect the 4800 baud serial terminal using the circuit here.

The PIC serial routines are simplex so you might as well use the same pin for TX and RX. I have found that a PIC will output a voltage that my PC seems happy with, without the need to resort to an MAXIM rs 232 chip.

When the PIC wants to send a character to the terminal, it makes RA0 an output and sends the character. It then makes the pin an input and the main loop polls for a start bit.

Authored by Douglas Rice at Homepage, Added: May 14, 2006



http://www.dougrice.plus.com/hp/freq/freq.htm

Unsorted Pool