code led rs485
RS485_TX.bas
'***************************************************
'***** mbyka - (c) Copyright 2002 **********
'***************************************************
' RS485 commminications
'TX
include "modedefs.bas"
datap var porta.0
dir var porta.1 'dir=1 then output, dir=0 then input
buton var portb.0
led var portb.1
veri var byte
baud con 84 '9600,N,8,1
start:
trisa=0
trisb=1
led=0
main:
if buton=1 then
call rs485_send
endif
pause 150
goto main
rs485_send:
led=1
dir=1
serout2 datap,baud,["X"]
led=0
return
*****************************************************
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
Main:
veri=$12
shiftout sdat,sclk,LSBFIRST,[veri]
oe=0
oe=1
oe=0
done:
@ sleep
goto done