Jump to content
TCSCOUT

Picaxe & Lcd's

Recommended Posts

I'm almost ready to wrap up this Topic for now. I worked on the code for the battery monitor and it's working good enough for me. It's with in about .05 volts of what me volt meter reads between around the voltage that I'm going to be reading. The power supply I'm using to test with doesn't have much range on it. Only goes up to 6 volts, but that what the build is powered with, so.... Also when it say Picaxe that's the voltage after the regulator, should alway be 3.30 volts. When it says battery it will read the voltage before the regulator. This is using the 2M and 1M resistors already on the AIO board and pin B.6 for battery monitor.

In the video the camera had a pic count of 9 day pics on the local PIR. To reset that I set the program so you have to hold the button 3 seconds to reset the count. I'm pleased with how it's all working. I'll post my code and stuff after I clean it up some in case someone wants to use any of it.

I'm ready to move on to something different or maybe go back and finish checking those new lens I got for the DXG125 that I never finished. Just need a break from the LCD for now :lol: Maybe later on I will come back and make it so I can change cam pic delay timing on this cam using the LCD. I have so much stuff in this build that I don't have any pins left to do that with :blink: . I won't bore you guys with anymore videos on the LCD, this will be the last one, :ph34r: , for a while :) .

 

Share this post


Link to post
Share on other sites
 

Very nice, you should be proud of that, hope to get my picaxe order soon so I can play a bit, I have a remote similar to yours but it is 12 volt and one channel, never thought about activating outside the build? never the less good job

Share this post


Link to post
Share on other sites
 
 

Here are the Codes for my Sony V1 with the LCD.

 

14M chip on the LCD:

 

 

'14M Picaxe on LCD

' *** Constants *********

    symbol baud   = input0            ' used to set Baud (hi=4800/lo=2400)
    symbol hi     = 1                    ' used to set Baud (hi=4800/lo=2400)
    symbol cmd    = 0                    ' used to set up for cmd/txt byte        
    symbol txt    = 1                    ' used to set up for cmd/txt byte
    symbol enable = 1                    ' LCD enable pin = PICAXE output1
    symbol RSin   = outpin0            ' LCD RegSel pin = PICAXE output0


' *** Variables *********

    symbol char  = b10                ' character to be sent to LCD
    symbol index = b11                ' used as counter in For-Next loops
    symbol RSbit = b12                ' used to set  for cmd/txt byte
    symbol temp  = b13                ' used to manipulate char


' *** Directives ********

                                
    #picaxe14M                            


' *** Begin Main Program *******************************************************

setfreq m8
gosub Init

do
    
    serin 4,N4800_8,b0,b1,b2,b3,b4,b5,b6,b7,b8


    char = b0
    gosub OutByte

    char = b1
    gosub OutByte

    char = b2
    gosub OutByte

    char = b3
    gosub OutByte

    char = b4
    gosub OutByte

    char = b5
    gosub OutByte

    char = b6
    gosub OutByte

    char = b7
    gosub OutByte

    char = b8
    gosub OutByte
loop


' *** End Main Program - Subroutines Follow ************************************


' *** Init Subroutine ***
Init:
    pins =  0                            ' clear all output lines
    pause 200                            ' pause 200 mS for LCD initialization

    pins = 12                            ' (48/4=12) set to 4-bit operation
    pulsout enable,1                    ' send data
    pause 10                                ' pause 10 mS

    pulsout enable,1                    ' send again
    pulsout enable,1                    ' send again (necessary in 4-bit mode)

    pins =  8                            ' (32/4=8) set to 4-bit operation
    pulsout enable,1                    ' send data.
    pulsout enable,1                    ' send again (necessary in 4-bit mode)

    pins = 32                            ' (128/4=32) set to 2 line operation

    pulsout enable,1                    ' send data

    char = 12                            ' turn off cursor
    gosub OutByte                        ' send instruction to LCD

    return


' *** OutByte Subroutine ***

OutByte:
    if char<32 OR char>127 then
         RSbit = cmd                    ' set up for command byte
    else
         RSbit = txt                    ' set up for text byte
    endif

    temp = char / 4                    ' because we're using DB5...DB2
    temp = temp & %00111100            ' mask for  DB5...DB2
    pins = temp                            ' place high nibble of char onto pins
    RSin = RSbit                        ' RSin = 0 for command or 1 for text
    pulsout enable,1                    ' send data

    temp = char * 4                    ' because we're using DB5...DB2
    temp = temp & %00111100            ' mask for  DB5...DB2
    pins = temp                            ' place low nibble of char onto pins
    RSin = RSbit                        ' RSin = 0 for command or 1 for text
    pulsout enable,1                    ' send data

    return

 

 

This is my Sony V1 Camera with the LCD Sending Data to the LCD From the 20X2 AIO

 

 'Sony V1 Camera, 20X2 AIO Board,Wired Remote for Camera, Zoom In/Out, 
'Laser Pointer,  Remote Controlled LCD, Local and Remote PIR's both with walktest, Hot Shoe 
'for Slave Flash, Remote Controlled Theft Alarm
'Updated last on 3/14/2012 by TCSCOUT
                                       
                                 
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

'Pin Dedicaton

'A.0   serial Out
'B.0   remote pir
'B.1   local pir
'B.2   local led
'B.3   cam power
'B.4   cam shutter
'B.5   cds read adc
'B.6   battery monitor for LCD readout
'B.7   cam zoom in
'C.0   cam zoom out
'C.1   remote pir led
'C.2   Remote for LCD ("A"on "B" off) (Latching Relay to save power) (Turn on/off LCD and 14M Picaxe)
'C.3   slave flash power
'C.4   spare
'C.5   cds power
'C.6   spare
'C.7   LCD menu select using remote button "C"

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

'Symbols

symbol LCD_data                 = A.0            'Serial Out to LCD
symbol remote_pir              = B.0          'Remote VT 
symbol local_pir               = B.1            'PIR on Cam
symbol local_led               = B.2            'LED on AIO Board
symbol cam_power               = B.3            'Cam Power
symbol cam_shutter             = B.4            'Cam Shutter
symbol cds_read_adc            = 10            'ADC for CDS Day/Night Sensor
symbol battery_monitor         = B.6            'battery voltage monitor for LCD readout        
symbol cam_zoom_in             = B.7            'Zoom In
symbol cam_zoom_out            = C.0            'Zoom Out
symbol remote_pir_led          = C.1            'Remote PIR LED/Lazer Pointer
symbol LCD_Counters_Reset     = C.2            'Remote ("A" Button On) ("B" Button Off) (Latching Relay) 
symbol slave_flash_power       = C.3            'Slave Flash Power
symbol spare_3                 = C.4            'Spare
symbol cds_power               = C.5            'CDS Power
symbol Spare                  = C.6            'Spare
symbol LCD_Status            = C.7            'Remote Button "C" Menu Next and Reset Counters
symbol abit             = 40            'Pause (Don't Change or won't update voltage)
symbol a_bit             = 40            'Pause    
symbol D0                 =   8            'display off
symbol D1                 =  12            'display on (cursor off)
symbol DC                 =   1            'display clear (cursor home)
symbol C0                 =  12            'cursor off (display on)
symbol C1                 =  14            'cursor on  (no blink)
symbol CB                 =  15            'cursor blink    
symbol CH                 =   2            'cursor home (display not cleared)
symbol L1                 =  16            'cursor left  one position
symbol R1                 =  20            'cursor right one position
symbol Q1                 = 128            'cursor at position 1 of line 1
symbol Q2                 = 136            'cursor at position 9 of line 1
symbol Q3                 = 192            'cursor at position 1 of line 2
symbol Q4                 = 200            'cursor at position 9 of line 2
symbol calibrate             = 92                'Calibration factor for ADC
symbol ADCval             = W5            'ADC result
symbol batV               = W6            'supply voltage 
symbol reading             = W7
symbol Day_Count             = b20            'Day Pics Count
symbol Night_Count         = b22            'Night Pics Count
symbol Total_Pic_Count        = b24            'Day plus Night Count
symbol Local_Wide_Count        = b28            'Local PIR Count (Lens Wide)
symbol Remote_Zoom_Count    = b30            'Remote PIR Count (Lens Zoom)

    
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

'b4 = 0 if day time 1 if night time
'b8 = 0 if local PIR 1 if remote PIR
'b9 = 0 if cam is in wide 1 if cam is in zoom

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

'Disable all PUs

pullup %00000000

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

'Directives

let adcsetup = %010000000000             'set up adc 10 and 11
let dirsA    = %00000001              'switch A pin 0 to output
let dirsB    = %10011100              'switch B pins 2,3,4 and 7 to outputs
let dirsC    = %00111011              'switch C pins 0,1,3,4 and 5 to outputs
disablebod

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx


'Code    

Camera_Test:
if pinC.2 = 1 then
goto LCD_Warm_up
endif 
high local_led                    'power on red led
high cam_power                    'power on camera
high slave_flash_power
pause 1000
low cam_power
pause 10000
low local_led
high remote_pir_led                'charge slave flash for 20 seconds
pause 10000
high cam_power                    'power off camera                    
pause 1000
low cam_power                     
low remote_pir_led                'power off red led
pause 2000
low slave_flash_power
goto walk_test                    'move to walk test

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

walk_test:
HIntSetup %01100110  
w0 = 300                                  '30 seconds
Do While w0 > 0  
if pinC.2 = 1 then
goto LCD_Warm_up
endif                         
If hint1flag = 1 Then                      'if remote PIR detects motion then
high remote_pir_led                         'power on laser led
pause 1000                                'keep LED on for a 1 second 
low remote_pir_led                        'power off laser led
w0 = 300                         'reset W0 timer
pause 3000                                'wait for PIR to settle 
hint1flag = 0
hint2flag = 0
endif
if hint2flag = 1 then                     'if local PIR detects motion then
high local_led                          'power on led
pause 1000                        'keep LED on for a 1 second
low local_led                    'power off led
w0 = 300                         'reset W0 timer 
pause 3000                                'wait for PIR to settle 
hint2flag = 0
hint1flag = 0
endif 
w0 = w0 - 1                        'decrease W0 timer by 1                               
pause 100
Loop 
do while w4 < 10
w4 = w4 + 1                                     
pulsout local_led , 30000
pause 250
loop
w4 = 0
do while w5 < 10
w5 = w5 + 1                                     
pulsout remote_pir_led , 30000
pause 250
loop
w5 = 0
HIntSetup %01100110                       'make b0 & b1 interrupts both set on rise
goto Interrupt                    'move to interrupt

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

interrupt:
W1 = 2                                  'refresh interval                        
Do While W1 > 0                    'if remote PIR or LCD Remote Push Button "A" then
If hint1flag = 1 Then                      'b8 = 1 if Remote PIR detects motion
b8 = 1                                  'move to turn on
goto turn_on                              
end if
If hint2flag = 1 Then                      'if motion is detected by local PIR then
b8 = 0                                  'b8 = 0 if local PIR detects motion
goto turn_on                              'move to turn on
end if            
W1 = W1 - 1                        'decrease W1 by 1
sleep 260                        '130 = approx 5 min X 2 loops = 10min
Loop
goto refresh_slave_flash                   'move to refresh 

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

refresh_slave_flash:
setfreq m8                        'set frequency back to 8 mhz
high slave_flash_power                
pause 10000                     'pause for 10 seconds to charge flash
low slave_flash_power
goto interrupt                    'return to interrupt

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

turn_on:
setfreq M8                        'set frequency back to 8 mhz
high cam_power                         'power on camera
high cds_power                       'power on CDS
b9 = 0                        'make b9 = 0 for camera lens in wide
readadc 10 , b7                      'read light
Pause 100    
if b7 > 117 then                  'night if > number entered here
b4 = 1                            'make b4 = 1 for night
high slave_flash_power
else b4 = 0                        'make b4 = 0 for day
endif
low cds_power                        ' power off CDS
pause 300 
low cam_power
if b8 = 1 then                      'b8 = 1 if motion was detectected by remote pir 
pause 3000
goto zoom                        'move to zoom
else 
pause 3000                        'pause 1.5 seconds
goto take_picture                    'move to take picture
endif

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

zoom:
high cam_zoom_in                     'zoom in camera lens
pause 2075                       
low cam_zoom_in                         'stop zooming in
b9 = 1                        'b9 = 1 if camera lens is in zoom 
pause 500
goto take_picture                    'move to take picture

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

wide:
high cam_zoom_out                     'zoom out camera lens
pause 2075                       
low cam_zoom_out                         'stop zooming in
b9 = 0                        'b9 = 0 if camera lens is in wide
pause 500
goto take_picture             

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

take_picture:
high cam_shutter                    'take picture
pause 1500                        'pause 1.5 seconds
low cam_shutter
pause 500
if b4 = 0 then
inc Day_Count
else 
inc Night_Count 
endif
if b9 = 0 then 
inc Local_Wide_Count
else inc Remote_Zoom_Count
endif
if b8 = 1 and b9 = 0 then              'b8 = 1 when remote PIR detected motion last
goto zoom                        'move to zoom
endif
pause 7000                        'pause 7 seconds
goto hot_standby                    'move to hot standby


'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

hot_standby:
W1 = 10000                              '1 minute
Do While W1 > 0
if pinC.2 = 1 then
goto LCD_Warm_up
endif
if pinB.1 = 1 and b9 = 0 then              'if motion is detected by local PIR and lens is set to wide 
b8 = 0                        'b8 = 0 if local PIR detected motion
goto take_picture                     'move to take picture
endif
if pinB.1 = 1 and b9 = 1 then            'if motion is detected by local PIR and lens is set to zoom
b8 = 0                        'b8 = 0 if local PIR detected motion
goto wide                        'move to wide
end if
if pinB.0 = 1 and b9 = 0 then            'if motion is detected by remote PIR and lens is se to wide
b8 =1                            'b8 = 1 if remote PIR detected motion
goto zoom                        'move to zoom                           
end if
if pinB.0 = 1 and b9 = 1 then               'if motion is detected by remote PIR and lens is set to zoom
b8 = 1                                     'b8 = 1 if remote PIR detected motion
goto take_picture                  'move to take picture
endif
W1 = W1 - 1                        'decrease W1 by 1
Loop
goto turn_off                    'move to turn off

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

turn_off:              
high cam_power                    'power off camera
pause 500
low cam_power                 
low slave_flash_power                            
hint1flag = 0                    'reset interrupt flag 1
hint2flag = 0                    'reset interrupt flag 2
pause 500
goto interrupt                       'move to interrupt


'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

LCD_Warm_up:
Pause 5000
gosub Clear_Display
goto Picaxe_Voltage

Picaxe_Voltage:
do
if pinC.2 = 0 then                        '0 = CAM MODE 1 = LCD MODE
goto Walk_Test
endif            
pause abit
serout a.0,N9600_16,(Q1,"        ")
pause 20
serout a.0,N9600_16,(Q2,"        ")
pause 20
serout a.0,N9600_16,(Q3,"Picaxe ")
pause 60
calibadc10 ADCval                            ' get ADC reading
batV = 53480 / ADCval                        ' convert it (see text)
batV = batV * 2                            ' (see text)
pause 20
bintoascii batV, b4, b3, b2, b1, b0                ' get digits
serout a.0,N9600_16,(Q4,b2,".",b1,b0," VDC")            
pause 20
if pinc.7 = 1 then                        'BUTTON "C"
Gosub Clear_Display
goto Battery_Voltage
endif
Loop

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Battery_Voltage:
do
if pinC.2 = 0 then                        ' 0 = CAM<<<<<>>>>>> 1 = LCD
goto Walk_Test
endif            
pause abit
serout a.0,N9600_16,(Q1,"        ")
pause 20
serout a.0,N9600_16,(Q2,"        ")
pause 20
serout a.0,N9600_16,(Q3,"Battery")
pause 60
readadc10 11, reading
reading = reading * 10 / calibrate
reading = reading * 10
pause 20
bintoascii reading, b4, b3, b2, b1, b0            ' get digits
serout a.0,N9600_16,(Q4,b2,".",b1,b0," VDC")            
pause 20
if pinc.7 = 1 then                        'BUTTON "C"
Gosub Clear_Display
goto Day_Pics_Menu
endif
Loop

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    
Day_Pics_Menu:
do
if pinC.2 = 0 then                        '0 = CAM MODE 1 = LCD MODE
goto Walk_Test
endif                
pause abit                    
serout a.0,N9600_16,(Q1,"        ")
pause 60
serout a.0,N9600_16,(Q2,"        ")
pause 60
serout a.0,N9600_16,(Q3,"Day Pics")
pause 60
serout a.0,N9600_16,(Q4," ",  #b20)            
pause 20
if pinc.7 = 1 then                        'BUTTON "C"
Gosub Clear_Display
goto Night_Pics_Menu
endif
Loop
    
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
            
Night_Pics_Menu:
do
if pinC.2 = 0 then                        '0 = CAM MODE 1 = LCD MODE
goto Walk_Test
endif                
pause abit                    
serout a.0,N9600_16,(Q1,"        ")
pause 60
serout a.0,N9600_16,(Q2,"        ")
pause 60
serout a.0,N9600_16,(Q3,"Night Pi")
pause 60
serout a.0,N9600_16,(Q4,"cs ",  #b22)            
pause 20
if pinc.7 = 1 then                        'BUTTON "C"
Gosub Clear_Display
goto Total_Pics_Menu
endif
Loop
    
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
            
Total_Pics_Menu:
b24 = b20 + b22 
do
if pinC.2 = 0 then                        '0 = CAM MODE 1 = LCD MODE
goto Walk_Test
endif            
pause abit                    
serout a.0,N9600_16,(Q1,"        ")
pause 60
serout a.0,N9600_16,(Q2,"        ")
pause 60
serout a.0,N9600_16,(Q3,"Total Pi")
pause 60
serout a.0,N9600_16,(Q4,"cs ",  #b24)            
pause 20
if pinc.7 = 1 then                        'BUTTON "C"
Gosub Clear_Display
goto Local_PIR_Count
endif
Loop        

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Local_PIR_Count:
do
if pinC.2 = 0 then                            '0 = CAM MODE 1 = LCD MODE
goto Walk_Test
endif            
pause abit                    
serout a.0,N9600_16,(Q1,"        ")
pause 60
serout a.0,N9600_16,(Q2,"        ")
pause 60
serout a.0,N9600_16,(Q3,"Local PI")
pause 60
serout a.0,N9600_16,(Q4,"R ", #b28)            
pause 20
if pinc.7 = 1 then                        'BUTTON "C"
Gosub Clear_Display
goto Remote_PIR_Count
endif
Loop

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Remote_PIR_Count:
do
if pinC.2 = 0 then                        '0 = CAM MODE 1 = LCD MODE
goto Walk_Test
endif            
pause abit                    
serout a.0,N9600_16,(Q1,"        ")
pause 60
serout a.0,N9600_16,(Q2,"        ")
pause 60
serout a.0,N9600_16,(Q3,"Remote P")
pause 60
serout a.0,N9600_16,(Q4,"IR ", #b30)            
pause 20
if pinc.7 = 1 then                        'BUTTON "C"
Gosub Clear_Display
goto Reset_Pics_Counter
endif
Loop

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
            
Reset_Pics_Counter:
b50 = 0
Do
if pinC.2 = 0 then                        '0 = CAM MODE 1 = LCD MODE
gosub Clear_Display
goto Walk_Test
endif    
if pinC.7 = 1 then 
gosub Clear_Display
goto LCD_Reset
Endif                    
pause abit                    
serout a.0,N9600_16,(Q1,"        ")
pause 60
serout a.0,N9600_16,(Q2,"        ")
pause 60
serout a.0,N9600_16,(Q3,"Press C ")
pause 60
serout a.0,N9600_16,(Q4,"To Reset")            
pause 3000
Gosub Clear_Display
pause abit                    
serout a.0,N9600_16,(Q1,"        ")
pause 60
serout a.0,N9600_16,(Q2,"        ")
pause 60
serout a.0,N9600_16,(Q3,"Press B ")
pause 60
serout a.0,N9600_16,(Q4,"To Exit ")    
pause 3000
inc b50
loop while B50 < 3
b50 = 0
gosub Clear_Display
goto Picaxe_Voltage

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx        
        
Clear_Display:
serout a.0, N9600_16,(Q1, Q2, Q3, Q4, 1)  'clear screen
pause 500
serout a.0,N9600_16,(Q1,"        ")
pause 60
serout a.0,N9600_16,(Q2,"        ")
pause 60
serout a.0,N9600_16,(Q3,"        ")
pause 60
serout a.0,N9600_16,(Q4,"        ")            
pause 20
Return

LCD_Reset:
Do
pause abit                    
serout a.0,N9600_16,(Q1,"        ")
pause 60
serout a.0,N9600_16,(Q2,"        ")
pause 60
serout a.0,N9600_16,(Q3,"Hold  C ")
pause 60
serout a.0,N9600_16,(Q4,"To Reset")            
pause 3000
if pinc.7 = 1 then
b20 = 0
b22 = 0 
b24 = 0
b28 = 0
b30 = 0
endif
pause 1500
inc b50
loop while B50 < 3
b50 = 0
gosub Clear_Display
goto Picaxe_Voltage
'The End LOL

Share this post


Link to post
Share on other sites
 

Thanks, saw my favorite bit of code "pause abit" don't think I saw that in the glossary, but I could be wrong. I will copy it down, my plans right now will only include pic info I think.

Share this post


Link to post
Share on other sites
 
Thanks, saw my favorite bit of code "pause abit" don't think I saw that in the glossary, but I could be wrong. I will copy it down, my plans right now will only include pic info I think.

 

Yep, I made one of my own too (a_bit) so I see in symbols that I have abit and a_bit. Both are the same as pause 40 so I could have just used 1 of those. But I was changing the timing so much and not sure if they will need to be different with a different chip or message.

Hope you make out OK with the 14M2's. I expect that you might have to play with the delays a little, but I know you will get it working. Keep us up on your progress when you get started.

Share this post


Link to post
Share on other sites
 

Saw pause abit in symbols, I guess a quick question is are you turning on power to LCD with remote? then it asks 20x2 for info? cant seem to figure out 20x2 code, triggering pir event will not wake from sleep in simulator? so if I change sleep number to 2 I can make some things happen by triggering pir event, but it is hard to follow on simulation. I see some sleepless nights in my future. "Picaxe Dreams"

Edited by mheimburg1

Share this post


Link to post
Share on other sites
 

Yes, Mark. Here is my drawing. Look at the latching relay at the lower left. It has 2 contacts and 2 coils. A pulse from "A" on the remote will close both contacts. the LCD will power up from one contact and the 20X2 will get a high on pin C.2 from the other contact and tell the board to goto the LCD menu and start sending data.

Then if I press button "C" on the remote it will step to the next item in the menu, Battery, Day Pics, Night Pics.....

Then to exit I hit button "B" and the remote pulses the other coil on the latching relay and opens both contacts, the LCD powers off and when C.2 goes low the 20X2 goes to Walk Test in the program.

You could use a double pole single throw switch instead of a remote and latching relay? Here is my drawing, I think it's up to date, I looked it over and it looks right.

 

Couldn't get it to upload here, so let me try photobucket.

SONYV1WITHZOOMplusLCDCorrectCopy.jpg

Share this post


Link to post
Share on other sites
 

Thanks TC, that's quite a pic, this one may take a while, hope to make my LCD board this weekend, was going to pull a 14m out of a build for LCD board and expand the program for cam with one of the 14m2's.

Share this post


Link to post
Share on other sites
 

Just want to add to this topic. I used the cheap LCD before, no back light and had to make my own chip to run the LCD. I bought a New LCD a long while ago from spark fun, it has what they call a backpack on it. All you have to do is connect 2 power wires to the LCD and 1 wire for communication to make it work. I had this Picamoo http://www.hagshouse.com/forums/index.php?...c=53923&hl= sitting here and decided to connected the LCD to it just to see it work. I already have one in my Sony V1 that I use to tell me how many day pics, night pics, battery power and so on....... But it doesn't have a back light. This one has a back light that you can send a signal from the picaxe and turn it on/off and dim and brighten it. The last one I did works by remote control to scroll through the menu.

Not sure what I'm going to use this on but thought I would post it, maybe someone will use this someday to get started playing with one? Here is my test video, it's the Picamoo board with a spark fun serial LCD. Just used my cell phone here at the desk so it' nothing fancy. It's reading my battery voltage to within .01 volts of what my meter is reading.

 

 

 

Here is my code:

 

 

 

'picaxe 08M2 Chip & Sparkfun Backpack LCD 
    symbol SC =  124
    symbol BO =  128                'backlight off
    symbol BL =  140                'backlight 40%
    symbol BM =  150                'backlight 70%
    symbol BH =  157                'backlight 100%
    symbol D0 =   8                ' display off
    symbol D1 =  12                ' display on (cursor off)
    symbol DC =   1                ' display clear (cursor home)
    symbol C0 =  12                ' cursor off (display on)
    symbol C1 =  14                'cursor on  (no blink)
    symbol CB =  15                ' cursor blink    
    symbol CH =   2                ' cursor home (display not cleared)
    symbol L1 =  16                ' cursor left  one position
    symbol R1 =  20                ' cursor right one position
    symbol Q1 = 128                ' cursor at position 1 of line 1
    symbol Q2 = 192                ' cursor at position 1 of line 2
    symbol abit = 40                'delay
    symbol calibrate             = 92  'Calibration factor for ADC
    symbol ADCval             = W5    'ADC result
    symbol batV               = W6    'supply voltage
    symbol lcd                    =c.2  'change to pin output to lcd is connected to
     'Lines 16X2     
     ' 1   2   3   4   5   6   7   8   9   10  11  12  13  14  15  16    
     '128 129 230 131 132 133 134 135 136 137 138 139 140 141 142 143
     '192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207
     
;=== Directives ===

    #picaxe 08M2                    ' set compiler mode
      setfreq m8                        'set to 8m speed
      pause 2000
      
;=== Begin Main Program ===============================================

    Main:
high c.2    
pause abit
serout lcd, t9600_8, (254,1)         'turn on backlight 
serout lcd, t9600_8, (254,12)     'turn on display
serout lcd, t9600_8, (124, 157)    'backlight full power
'Picaxe Voltage:
do
pause abit
calibadc10 ADCval                            ' get ADC reading
batV = 52825 / ADCval                        ' convert it (see text)
batV = batV * 2                            ' (see text)
pause abit
bintoascii batV, b4, b3, b2, b1, b0                ' get digits
serout lcd, t9600_8, (254, 128," Picaxe Voltage ")
serout lcd, t9600_8,(254,196,b2,".",b1,b0," VDC")            
wait 10

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

'Battery_Voltage:

calibadc10 ADCval                            ' get ADC reading
batV = 62450 / ADCval                        ' convert it 
batV = batV * 2                            ' (see text)
pause abit
bintoascii batV, b4, b3, b2, b1, b0                ' get digits
serout lcd, t9600_8, (254, 128, "Battery Voltage ")
serout lcd, t9600_8,(254, 196,b2,".",b1,b0," VDC    ")            
wait 10
Loop

Share this post


Link to post
Share on other sites
 

I also took the 08M2 chip out of the Picamoo board and put in a 20X2. Only changed 2 things in the code for this to work. One was the output pin designation and the other was the 08M2 to 20X2 in the code.

 

 

Here is the code for this 20X2 video.

 

'picaxe 20X2 Chip & Sparkfun Backpack LCD 
    symbol SC =  124
    symbol BO =  128                'backlight off
    symbol BL =  140                'backlight 40%
    symbol BM =  150                'backlight 70%
    symbol BH =  157                'backlight 100%
    symbol D0 =   8                ' display off
    symbol D1 =  12                ' display on (cursor off)
    symbol DC =   1                ' display clear (cursor home)
    symbol C0 =  12                ' cursor off (display on)
    symbol C1 =  14                'cursor on  (no blink)
    symbol CB =  15                ' cursor blink    
    symbol CH =   2                ' cursor home (display not cleared)
    symbol L1 =  16                ' cursor left  one position
    symbol R1 =  20                ' cursor right one position
    symbol Q1 = 128                ' cursor at position 1 of line 1
    symbol Q2 = 192                ' cursor at position 1 of line 2
    symbol abit = 40                'delay
    symbol calibrate             = 92  'Calibration factor for ADC
    symbol ADCval             = W5    'ADC result
    symbol batV               = W6    'supply voltage
    symbol lcd                    =b.1  'change to pin output to lcd is connected to
     'Lines 16X2     
     ' 1   2   3   4   5   6   7   8   9   10  11  12  13  14  15  16    
     '128 129 230 131 132 133 134 135 136 137 138 139 140 141 142 143
     '192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207
     
;=== Directives ===

    #picaxe 20X2                    ' change this to type of chip used
      setfreq m8                        'set to 8m speed
      pause 2000
      
;=== Begin Main Program ===============================================

    Main:
high c.2    
pause abit
serout lcd, t9600_8, (254,1)         'turn on backlight 
serout lcd, t9600_8, (254,12)     'turn on display
serout lcd, t9600_8, (124, 157)    'backlight full power
'Picaxe Voltage:
do
pause abit
calibadc10 ADCval                            ' get ADC reading
batV = 52825 / ADCval                        ' convert it (see text)
batV = batV * 2                            ' (see text)
pause abit
bintoascii batV, b4, b3, b2, b1, b0                ' get digits
serout lcd, t9600_8, (254, 128," Picaxe Voltage ")
serout lcd, t9600_8,(254,196,b2,".",b1,b0," VDC")            
wait 10

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

'Battery_Voltage:

calibadc10 ADCval                            ' get ADC reading
batV = 62450 / ADCval                        ' convert it 
batV = batV * 2                            ' (see text)
pause abit
bintoascii batV, b4, b3, b2, b1, b0                ' get digits
serout lcd, t9600_8, (254, 128, "Battery Voltage ")
serout lcd, t9600_8,(254, 196,b2,".",b1,b0," VDC    ")            
wait 10
Loop

Share this post


Link to post
Share on other sites
 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×