Hi all, I am new to PIC. I have some experience with the BasicStamp.
I have been trying for the past few days to figure out the Serial IO on a PIC16F88 (unsuccessfully). I am using HyperTerminal (2400,N,8,1, No Flow control).
I have been able to get debug to communicate with HT, but been unable to get any legible data in or out with SerIn/SerIn2, SerOut/SerOut2.
Basically I have 2 laptops setup as described above (using serial port pin 3,5 to xmit, using pin 2,5 to RX). I have tried many variations of the below code. What is interesting (at least to me) is that When only the RX computer is connected I do get my "STARTING" message. When I connect the TX computer to the PIC I do not even get the start up message.
Ultimately, I would like to be able to read serially computer1, process a string (terminated by CR/LF). Then output serially (not using DEBUG) to computer 2 some text based on the processed incoming data.
I am really confused and not sure if problems are due to baud settings (I have tried many) or not comparing correctly (not really clear on if I need to use DEC or # to compare an ASCII string). Also I don't understand why I can't even see my startup line when both computers are connected.
Should I use SerIn or SerIn2?
TIA
----- CODE -------
OSCCON = $60
@ DEVICE INTRC_OSC_NOCLKOUT, MCLR_OFF, PROTECT_OFF, WDT_OFF
@ DEVICE PIC16F88
CMCON = 7 'Comparators OFF
ANSEL = 0 'A/D OFF -- Port pins all digital
DataIn Var BYTE
DEFINE DEBUG_REG PORTA
DEFINE DEBUG_BIT 4
DEFINE DEBUG_BAUD 2400
Input PortA.3
OUTPUT portA.4
PAUSE 100
DEBUG "STARTING",13,10
LOOP:
Serin PortA.3,4,[DataIn]
DEBUG "DATA ",DATAIn,13,10
GOTO LOOP
Bookmarks