Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
I think it will work. I have not used pic basic recently. The answer probably is on the PIC Basic forum. Do you get an error when you try it?
You need to :
Include "bs2defs.bas"
Pic Basic Pro
hi,
This demo works on Oshonsoft
Code:Dim i As Byte Dim p As Byte TRISB = 0x00 loop1: PORTB.0 = 1 WaitMs 10''''''''''''''''''''added For i = 0 To 7 'loop for 8 counts PORTB = ShiftLeft(PORTB, 1) WaitMs 10 Next i Goto loop1
main:
PORTB = writeport(LATB, 3, 1)
PORTC = writeport(LATC, 2, 0)
PORTB = writeport(LATB, 6, 1)
PORTC = writeport(LATC, 1, 0)
Goto main
End
Function writeport(port As Byte, pin As Byte, condition As Byte) As Byte
Dim idx As Byte
Dim buf As Byte
idx = LookUp(1, 2, 4, 8, 16, 32, 64, 128), pin 'POWER OF 2
buf = port 'READ PORT ( LATCH )
idx = Not idx 'INVERT ALL BUT PIN
buf = buf And idx 'AND TO CLEAR BIT
If condition = 0 Then 'IF PIN NEEDS CLEARING FIN HERE
writeport = buf 'RETURN WITH ONLY THAT PIN CLEARED
Exit
Endif
idx = Not idx 'OTHERWISE WE NEED TO
buf = buf Or idx 'SET JUST THAT PIN
writeport = buf ' ALL DONE
End Function