Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

pic to pic 16f84 rs485 routine

Status
Not open for further replies.
16f84 rs485

RS485_RX.bas

'***************************************************
'***** mbyka - (c) Copyright 2002 **********
'***************************************************
' RS485 comminications
'TX

include "modedefs.bas"

datap var porta.0
dir var porta.1 'dir=1 then output, dir=0 then input
led1 var portb.0
led2 var portb.1
veri var byte
baud con 84 '9600,N,8,1


start:
trisa=1
trisb=0
led1=0
led2=0
main:
dir=0
serin2 datap,baud,100,main,[veri]
led1=1
pause 150
led1=0
'
if veri="X" then
led2=1
pause 150
led2=0
endif
goto main
 

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
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top