PDA

View Full Version : Serial Input, PIC12f629



kdh0009
- 9th August 2006, 10:40
I am trying to assign variables through the serial port which connects my pc to my pic. However all attempts so far have failed and each time my program times out and continues on with empty variables.

I have found a number of suggestions online but so far none have helped.
This is the opening part of my code, that relates to the Serial Input part of the code. (As written in microcode studio)

define OSC 16 'Oscillator speed in MHz
CMCON = %00000111 'Comparator Control Register
INPUT GPIO.1

c_cr con 13 'Carriage Return character
c_lf con 10 'Line Feed Character
c_sermode con 16468 '9600 Baud, Driven, Inverted, No Parity

b VAR BYTE

p_txd var GPIO.0
p_rxd var GPIO.1

init:
'Clear all variables
clear

SERIN2 p_rxd,c_sermode,10000,timeout,[WAIT("1"),DEC b]

I feel i must have missed some part of the setup. Any suggestions would be very helpful.

Thanks

Kieran.