PDA

View Full Version : serin and serin2??? need to understand



tkly36
- 6th April 2006, 12:50
'using pic16f84

INCLUDE "modedefs.bas"

DEFINE CHAR_PACING 1000

kdg var byte[3]
i var byte

pause 2000
here:
SerOut PORTA.0,t2400,["input value from 1 to 200",13,11]
pause 1000

i=0
start:
serin PORTA.2,t2400,[kdg[i]]
i=i+1
if kdg[i]==9 then start

SerOut PORTA.0,t2400,["the value your enter is ",kdg[i],13,11]
pause 2000

where is the wrong in my coding?
how to make the serin accept more that 1 character.?

PoTeToJB
- 6th April 2006, 22:41
ok
i use 2 pic16f84a.

1 for send variable data. (pic1)
1 for receive the varia ble data.(pic2)

pic1

INCLUDE "modedefs.bas"
DEFINE CHAR_PACING 1000
define osc 4

digit1 var word
digit2 var word

digit1=0
digit2=0
start:

if portb.0=1 then
digit1=digit1+1
end if

if portb.1=1 then
digit2=digit2+1
endif

serout porta.0,n2400, ["OK",digit2,digit1] ' send OK 1st, digit2 2nd and digit1 3rd

goto start
end

pic2

INCLUDE "modedefs.bas"
define osc 4

nilai1 var word
nilai2 var word

nilai1=0
nilai2=0

lcdout $FE,1
lcdout "ready"
start:

serin porta.0,n2400, ["OK"],nilai2,nilai1 ' recieve OK 1st (true),2nd put digit2 to nilai2 and 3rd put digit1 to nilai1

'for see the input value

lcdout $FE,1
lcdout "Nilai"
lcdout $FE,$CO
lcdout DEC3 nilai2,DEC3 nilai1

goto start
end

i hope this help u abit
if u send data( serout) the another must ready to recieve data(serin).
that is very importent

tkly36
- 7th April 2006, 05:13
thanx

sorry not mention early about my situation...
my project is about communicate from PIC to computer
i'm using hyperterminal to communicate with the PIC.
but when i try input a number as example 100 or 11.the monitor show only the first digit of input of the number...

i hope you can explaine more on serin command..

:) :)