Dave
Always wear safety glasses while programming.
hehehe yeah i know what you mean, ok lets getting started i already have mi pc connected to mi pic and i have signal from the port , know what i have to do to receive temperature readings from it ?![]()
I do not use .net, but if it is anything like VB this might help.
http://www.rentron.com/serial.htm
Write code in whatever language you are using to read the serial port or use a terminal program for testing.
If it is an ADC problem with the PIC the above site has a good example.
Show some code and it will help us to answer questions.
Dave
Always wear safety glasses while programming.
I already got the whole circuit working, I already tried turn on a led and it worked, so I need some help with this code, hope anyone can help me, thanks
DEVICE = 16F873A
CONFIG WDT_OFF, XT_OSC, CP_OFF, PWRTE_ON, BODEN_OFF , LVP_OFF , DEBUG_OFF
XTAL = 4
SYMBOL LED = PORTA.2
'SYMBOL DIRECTION = PORTB
DIM TEMPERATURE AS BYTE
DIM READ AS BYTE
DIM DIR0 AS BIT
DIM DIR1 AS BIT
DIM DIR2 AS BIT
TRISA=%00000001 'make in porta.0
ADCON1=%00001010 'analogic porta.0 y digital porta.2
ADIN_RES = 8 'bits to take un count
ADIN_TAD = FRC 'oscilator frecuency
ADIN_STIME = 50 'capacitor's charge time
DECLARE HSERIAL_BAUD =2400
DECLARE HSERIAL_RCSTA =%10010000
DECLARE HSERIAL_TXSTA = %00100010
DECLARE HSERIAL_CLEAR = ON
'DECLARE HSERIAL_PARITY = OFF
TEMPERATURE = ADIN 0
'HSERIN [DEC READ]
DELAYMS 600
WHILE 1
'HSERIN [DEC READ]
HSEROUT ["T"]
HSEROUT [DEC TEMPERATURE]
HSEROUT ["D"]
DIR0 = PORTB.0
DIR1 = PORTB.1
DIR2 = PORTB.2
IF DIR0=0 AND DIR1=0 AND DIR2=0 THEN HSEROUT [0]
IF DIR0=0 AND DIR1=0 AND DIR2=1 THEN HSEROUT [1]
IF DIR0=0 AND DIR1=1 AND DIR2=0 THEN HSEROUT [2]
IF DIR0=0 AND DIR1=1 AND DIR2=1 THEN HSEROUT [3]
IF DIR0=1 AND DIR1=0 AND DIR2=0 THEN HSEROUT [4]
IF DIR0=1 AND DIR1=0 AND DIR2=1 THEN HSEROUT [5]
IF DIR0=1 AND DIR1=1 AND DIR2=0 THEN HSEROUT [6]
IF DIR0=1 AND DIR1=1 AND DIR2=1 THEN HSEROUT [7]
HSERIN [WAIT(","),DEC LEER]
DELAYMS 500
HSEROUT [LEER]
'IF LEER=1 THEN LED=1 GOTO NEXT
'SIG:
'IF LEER=0 THEN LED=0 GOTO NEXT2:
'SIG2:
WEND
END
I'm having some issues reading temp, can anyone give me some help i dont know what to do now![]()
Did you read the articles on this site?
http://www.rentron.com/pic.htm
Are you using Pic Basic?
Dave
Always wear safety glasses while programming.
If you're using DEC in HSERIN, you want to use DEC in HSEROUT as well. You USART settings seems weird to me, this following..
But HSEROUT should take care of it. You could still try...Code:DECLARE HSERIAL_TXSTA = %00100010
This set manually the PIC USART register.Code:HSERIAL_RCSTA=$90 HSERIAL_TXSTA=$20 HSERIAL_SPBRG=25 ' 2400 Bauds HSERIAL_CLEAR=ON
Proton forum![]()
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
You can make this circuit.
http://www.picbasic.co.uk/forum/showthread.php?t=8493
Bookmarks