the old fart
Senior Member
This controls a cctv camera internal menu.
Can be expanded for Pan/Tilt
20M2 chip at 4800baud rate, to ST485CN and a keypad.
ST485CN
pin1 10k reistor to +5v
pin2 tied to +5v
pin3 tied to +5v
pin4 from C.0
pin5 tied to 0v
pin6 A to camera
pin7 B to camera
pin8 tied to +5v
no reistor A-B
SEN040 Data Entry Keypad
Pin C.1 to C1 keypad
Pin C.2 to C2 keypad
pin C.3 to C3 keypad
pin B.1 to R1 keypad
pin B.2 to R2 keypad
pin B.3 to R3 keypad
pin B.4 to R4 keypad
Thanks to all who helped with this project, cheers guys.
Dave
Can be expanded for Pan/Tilt
20M2 chip at 4800baud rate, to ST485CN and a keypad.
ST485CN
pin1 10k reistor to +5v
pin2 tied to +5v
pin3 tied to +5v
pin4 from C.0
pin5 tied to 0v
pin6 A to camera
pin7 B to camera
pin8 tied to +5v
no reistor A-B
SEN040 Data Entry Keypad
Pin C.1 to C1 keypad
Pin C.2 to C2 keypad
pin C.3 to C3 keypad
pin B.1 to R1 keypad
pin B.2 to R2 keypad
pin B.3 to R3 keypad
pin B.4 to R4 keypad
Code:
;
;cctv menu controller
; keypad 5 enter
; keypad 2 move up
; keypad 8 move down
; keypad 4 move left
; keypad 6 move right
;20M2
low b.1,b.2,b.3,b.4
symbol key_pos=b1
symbol key_value=b2
symbol display=b4
let display = 128
let key_pos=0
start:
scan:
let key_value=0
high b.1
gosub key_test
low b.1
let key_value=3
high b.2
gosub key_test
low b.2
let key_value=6
high b.3
gosub key_test
low b.3
let key_value=9
high b.4
gosub key_test
low b.4
goto scan
key_test:
if pinc.1=1 then add1
if pinc.2=1 then add2
if pinc.3=1 then add3
return
add3: let key_value=key_value+1
add2: let key_value=key_value+1
add1: let key_value=key_value+1
serout b.0,N2400,(254,display,#key_value," "); used for degugging only
if key_value=5 then gosub openmenu
if key_value=6 then gosub goright
if key_value=4 then gosub goleft
if key_value=2 then gosub goup
if key_value=8 then gosub godown
display=display+1
if display>148 then let display=128:endif
return
openmenu:
serout c.0,T4800,(0xFF,0x01,0x00,0x07,0x00,0x5F,0x67)
pause 1000
return
goright:
serout c.0,T4800,(0xFF,0x01,0x00,0x80,0x00,0x00,0x81)
pause 1000
return
goleft:
serout c.0,T4800,(0xFF,0x01,0x01,0x00,0x00,0x00,0x02)
pause 1000
return
godown:
serout c.0,T4800,(0xFF,0x01,0x00,0x40,0x00,0x00,0x41)
pause 1000
return
goup:
serout c.0,T4800,(0xFF,0x01,0x00,0x20,0x00,0x00,0x21)
pause 1000
return
Dave