bilde til bilde 16f84 rs485 rutine

RS485_RX.bas

'************************************************* **
'***** Mbyka - (c) Copyright 2002 **********
'************************************************* **
"RS485 comminications
'TX

include "modedefs.bas"

datap var porta.0
dir var porta.1 'dir = 1 deretter utgang, dir = 0 og skriving
led1 var portb.0
led2 var portb.1
veri var byte
baud con 84'9600, N, 8,1Oppstart:
trisa = 1
trisb = 0
led1 = 0
led2 = 0
hovedinnhold:
dir = 0
serin2 datap, baud, 100, main, [veri]
led1 = 1
pause 150
led1 = 0
'
hvis veri = "X" og deretter
led2 = 1
pause 150
led2 = 0
endif
goto hovedinnhold

 
RS485_TX.bas

'************************************************* **
'***** Mbyka - (c) Copyright 2002 **********
'************************************************* **
"RS485 commminications
'TX

include "modedefs.bas"

datap var porta.0
dir var porta.1 'dir = 1 deretter utgang, dir = 0 og skriving
buton var portb.0
ledede var portb.1
veri var byte
baud con 84'9600, N, 8,1Oppstart:
trisa = 0
trisb = 1
ledede = 0
hovedinnhold:
hvis buton = 1 deretter
samtale rs485_send
endif
pause 150
goto hovedinnholdrs485_send:
ledede = 1
dir = 1
serout2 datap, baud, [X]
ledede = 0
tilbake

************************************************** ***

SHIFTOUT.bas'************************************************* **
'***** Mbyka - (c) Copyright 2002 **********
'************************************************* **
'74HC595 Kullanımı

include "modedefs.bas"

oe var portc.0
sclk var portc.1
sdat var portc.2
veri var byte

Start:
trisc = 0
portc = 0
Hovedbilde:
veri = $ 12
shiftout sdat, sclk, LSBFIRST, [veri]
oe = 0
oe = 1
oe = 0
gjort:
@ Sove
goto gjort

 

Welcome to EDABoard.com

Sponsor

Back
Top