التدريب الثانى : الاستقبال عن طريق الدالة Serin :
البرنامج :
;communications2-without-MAX232-SerIn (Reciever)
Include "modedefs.bas" ;Include communication modes
Device = 16F628A
Xtal=4
All_Digital=true ;all port A switch to digital mode
LCD_DTPin PORTB.4
LCD_RSPin PORTB.2
LCD_ENPin PORTB.3
Dim dat As Byte ;storing variable 255
Print Cls
Print At 1,1,"LCD ready" ;text to verify the connection
Print $FE,$C0 ;Move cursor to beginning of second line
start:
SerIn PORTB.0 , T2400 , [dat] ;expect the data and save it to dat
Print dat
GoTo start ;going to wait for the next character
End