Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 05:29 26 Nov 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Electronics : Picaxe 28X

     Page 2 of 3    
Author Message
scnarine
Newbie

Joined: 17/06/2011
Location: United States
Posts: 29
Posted: 09:54am 21 Mar 2013
Copy link to clipboard 
Print this post

I found the following on a picaxe forum, Does this make any sense or ring a bell for you guys,,,,.....I hope by the end I can become good as you guys....I think I am begining to comprehend some of this coding.....

SAborn

06-05-2012, 03:54

You can try this code as a test, but you will need to change the wiring of the display to suit this.

RB4 to B.0
RB5 to B.1
RB6 to B.2
RB7 to B.3
EN to B.4
RS to B.5

Then this code should work for you, it is important it is wired exactly as above.
If this dont work then it would imply you do not have the rest of the display wired correctly, as per the wiring example in the picaxe manual.




symbol temp = b0
symbol y = b1
symbol en = B.4
symbol rs = B.5


setfreq m4

let dirsB = %11111111
pause 1000
gosub init

main:


pause 1000
temp = 1
gosub wrins
temp = 128 : gosub wrins
for y = 0 to 14
lookup y,("**THE DISPLAY**"),temp
gosub wrchr
next y
temp = 192 :gosub wrins
for y = 0 to 14
lookup y,("**** WORKS ****"),temp
gosub wrchr
next y


goto main


init:
pinsB = 0 :pulsout en,5 'reset all hardware
pause 10
pinsB = %00000010: pulsout en,5 '4 bit mode
temp = %00101100 : gosub wrins '

temp = %00001100 : gosub wrins 'display control

temp = %00000001 : gosub wrins 'clear display

pause 2
temp = %00000110 : gosub wrins 'entry mode

return


wrchr:
pinsB = temp/16
high rs
pulsout en,5
pinsB = temp and 15
high rs
pulsout en,5
return

wrins:
pinsB = temp/16
pulsout en,5
pinsB = temp and 15
pulsout en,5
return

------------------------------------------------------------ --------------------



angeljruiz

06-05-2012, 06:01

Thanks you very much! It works perfect :D

------------------------------------------------------------ --------------------



SAborn

06-05-2012, 09:42

Have you worked out what was wrong with the previous code and set up you had.

Although the example i gave is simpler i think.

Now you have it working here is some more LCD code commands that should all work with your display if you need them.
Each command will need to be used like this.

temp = 1
gosub wrins

Where you would change the "1" to the command code, followed by "Gosub wrins" (write instruction).

symbol dispoff = 8 'display off
symbol dispon = 12 'display on
symbol home = 2 'cursor to home, i.e line 1 start
symbol clear = 1 'clear contents of display and cursor to home
symbol line1 = 128 'start of line 1
symbol l1end = 145 'end of line 1
symbol line2 = 192 'start of line 2
symbol l2end = 209 'end of line 2
symbol resett = 0 'master reset command
symbol scrleft = 5 'scroll display left to right
symbol scrright = 7 'scroll display right to left
symbol scroff = 4 'scroll off
symbol single = $20 'top line display only
symbol double = $2c 'top and bottom lines displayed
symbol curson = $0e
symbol cursoff = $0c
symbol cursblink = $0f
 
scnarine
Newbie

Joined: 17/06/2011
Location: United States
Posts: 29
Posted: 12:55pm 21 Mar 2013
Copy link to clipboard 
Print this post

I will add this for LCD initialization.

let dirsB = %11111111
let adcsetup = %00000011 ' For PICAXE-28X2 (18F25K22)
' adcsetup = %00000011 ' For PICAXE-28X2-3V (18F25K20)
' adcsetup = 2 ' For PICAXE-28X2-5V (18F2520)

And it appears that the PICAXE-X2 chips require a different wireing to the LCD display so I will rewire the display to suit this configuration.

RB4 to B.0
RB5 to B.1
RB6 to B.2
RB7 to B.3
EN to B.4
RS to B.5

and will let you guys know what happened. I may also have to use the "setfreq m4" command since the PICAXE-28X codes are written for 4MHz.
 
Downwind

Guru

Joined: 09/09/2009
Location: Australia
Posts: 2333
Posted: 03:01pm 21 Mar 2013
Copy link to clipboard 
Print this post

  Quote   Does this make any sense or ring a bell for you guys,,,,.....


Hmmm, Yes i posted that, out of all the examples on the other forum you fished out one i posted, how weird is that?

I can not make head nor tail of Glenns initiation routine and to me looks to be missing something as i dont see where the lcd RS pin is toggled, but i could be wrong.

I had found the above lcd test program here last night and was intending to post it for you to try, i just needed to find the schematic to go with it, i could not remember what thread it was in on the other forum to send you there.

The program should run at any speed and the "setfreq m4" should not be required.

Just be careful using Let adcsetup = %xxxxxxxx as you need to set the correct adc pins to suit your circuit, but yes the command needs to be used with the 28x2 chip.

Same for the Let dirB = %xxxxxxxx as in the above code it sets all the "B" pins to outputs, that is ok if no other B pins are used for inputs in the circuit.

Pete.
Sometimes it just works
 
scnarine
Newbie

Joined: 17/06/2011
Location: United States
Posts: 29
Posted: 03:35pm 21 Mar 2013
Copy link to clipboard 
Print this post

I added this chunk of code to Mr. Pete conversion he posted above

' Converted by X2 Conversion Wizard Version 2.0.5 (2010r4.1)

let dirsB = %11111111
let adcsetup = %00000011 ' For PICAXE-28X2 (18F25K22)
' adcsetup = %00000011 ' For PICAXE-28X2-3V (18F25K20)
' adcsetup = 2 ' For PICAXE-28X2-5V (18F2520)

I use the program editor wizard and convert Mr. Gizmos original version 2 code and compare it both with Mr. Pete X2 conversion code and the only difference was the piece of code above and the nap command. so I added this to Mr. Pete code and I get this.




I also tried to rewire as I mention in previous post but that did nothing. I also add the "setfreq m4" command and still no luck...

My other guess is the LCD...But if the LCD works fine with the version 1 code shouldn't it work for the version 2 code? here is the specs of my LCD.... http://www.taydaelectronics.com/datasheets/A-1749.pdf

The program seems to be running, but no visual on the LCD. If I hit the menu button and up /down buttons I recognized changes on the LCD. Just the characters are not recognizable...

 
Downwind

Guru

Joined: 09/09/2009
Location: Australia
Posts: 2333
Posted: 04:05pm 21 Mar 2013
Copy link to clipboard 
Print this post

The problem we have is Glenn did not list the "DB" pins for his LCD in the schematic, so the pinouts of his lcd and yours might be different, as there is several versions of lcd around with different pinouts.
Although they look to be the same pinouts.

The messed up charactors are most likely caused by the wrong order of wiring from picaxe and lcd DB pins, causing the data to be sent to the display in the wrong order.

From what i can workout the display should be connected as follows

B.7 to DB7
B.6 to DB6
B.5 to DB5
B.4 to DB4
B.3 to E
B.2 to RS

That is if Glenns display has the same pinouts as yours.
Sometimes it just works
 
Downwind

Guru

Joined: 09/09/2009
Location: Australia
Posts: 2333
Posted: 06:10pm 21 Mar 2013
Copy link to clipboard 
Print this post

If you want to test your LCD then this program should work with the 28x2 if it is wired as per the schematic below, just ensure the picaxe pin numbers are wired to the LCD DB and En, RS pins in the correct order.


'&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

'LCD Test program for 28x2

'&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

'&&&&&&&&&&&&&&&&&&&&& Part 1 &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&



#picaxe 28x2

symbol temp = b0 'Temporary working variable for characters
symbol y = b1 'Variable used in "For/Next" loops
symbol en = B.4 'B.1 pin as display Enable
symbol rs = B.5 'B.0 pin as display reset
symbol LCD_pins = PinsB 'LCD pins DB4,DB5,DB6,DB7

setfreq m4

let dirsB = %00111111 'Set port B pins as outputs

pause 200
gosub init 'Initiate the display


'&&&&&&&&&&&&&&& Part 2 &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&


main:
temp = 1 'clear the screen by sending a 1
gosub wrins 'write the instruction to the display

temp = 128 'select the top line of the display by sending 128
gosub wrins 'write the instruction to the display

for y = 0 to 14 'Loop to write each byte of the text below to the display (15 characters, 15 bytes)
lookup y,("---- HELLO ----"),temp 'lookup each character and put in TEMP variable to be written to the display
gosub wrchr 'Write each character to display
next y

temp = 197 'start of second line
gosub wrins 'write the instruction to the display

for y = 0 to 10 'Loop to write each byte of the text below to the display (9 characters, 9 bytes)
lookup y,("-IT WORKS-!"),temp 'lookup each character and put in TEMP variable to be written to the display
gosub wrchr 'Write each character to display
next y


pause 1000


goto main


'&&&&&&&&&&&&&& Part 3 &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&


init:
low rs
LCD_pins = 0 :pulsout en,5 'reset all hardware
pause 10
LCD_pins = %00000010 :pulsout en,5
temp = %00101100 : gosub wrins '(44)4 bit mode
temp = %00001100 : gosub wrins '(12)display control
temp = %00000001 : gosub wrins '(1)clear display
pause 2
temp = %00000110 : gosub wrins '(6)entry mode

return


wrchr:
LCD_pins = temp/16
high rs
pulsout en,5
low rs
LCD_pins = temp and 15
high rs
pulsout en,5
low rs
return

wrins:

low rs
LCD_pins = temp/16
pulsout en,5
LCD_pins = temp and 15
pulsout en,5
return


'&&&&&&&&&&&&&&& End &&&&&&&&&&&&&&&&&&&&&




2013-03-22_041308_LCD_28x2_PinsB.pdf Edited by Downwind 2013-03-23
Sometimes it just works
 
scnarine
Newbie

Joined: 17/06/2011
Location: United States
Posts: 29
Posted: 06:57pm 21 Mar 2013
Copy link to clipboard 
Print this post

B.7 to DB7
B.6 to DB6
B.5 to DB5
B.4 to DB4
B.3 to E
B.2 to RS

That is how I have it connected see my pin config




But I will rewire the lcd tomorrow and try your test above. If the same wiring works on the version 1 code, can it still be incorrect for the version 2 code?
 
Downwind

Guru

Joined: 09/09/2009
Location: Australia
Posts: 2333
Posted: 07:46pm 21 Mar 2013
Copy link to clipboard 
Print this post

One thing i noticed that i did not change in the version 2 code was these lines where it has "PULSOUT 3,2" it dont show a syntax error it should be "PULSOUT B.3,2"


SendCmdByte:
b13 = %00000000 'Send to Command register
SendDataByte:
pinsB = b12 & %11110000 | b13 'Put MSB out first
PULSOUT B.3,2 'Give a 10uS pulse on E
pinsB = b12 * %00010000 | b13 'Put LSB out second
PULSOUT B.3,2 'Give a 10uS pulse on E
b13 = %00000100 'Send to Data register next
RETURN


Change the PULSOUT in your code to read B.3,2 as in red above.
I susspect the command wont work correctly without the "B." prefix before the 3.

Pete.Edited by Downwind 2013-03-23
Sometimes it just works
 
Downwind

Guru

Joined: 09/09/2009
Location: Australia
Posts: 2333
Posted: 08:20pm 21 Mar 2013
Copy link to clipboard 
Print this post

To make life easy here is a revised full copy of version 2 code with all changes made, so you can dump it directly into the 28x2 chip and see if it works.

Pete.



' Charge Controller
' Ver 2010B
' 28X chip
' www.thebackshed.com

'Version #2

Start:

#picaxe 28x2

EEPROM 0,( $33 )
EEPROM 1,( $32 )
EEPROM 2,( $28 )
EEPROM 3,( $0C )
EEPROM 4,( $06 )
EEPROM 5,( $01 )
EEPROM 6,("V ")
EEPROM 9,("A ")
EEPROM 12,("W ")
EEPROM 15,("Wmax ")
EEPROM 22,("O/P 1 On ")
EEPROM 31,("O/P 1 Off ")
EEPROM 41,("O/P 2 On ")
EEPROM 50,("O/P 2 Off ")
EEPROM 60,("Zero Amp Offset")
EEPROM 75,("Press UP ")
EEPROM 84,("Done ")
EEPROM 93,("Wait ")

dirsB = %11111111
adcsetup = %00000011

' Set min watt max
W0=0
Poke 204, WORD W0
' Check to see if we have any O/P switching values in EEPROM
read 110, WORD W0
if W0=0 then Menu1 ' if not go to set up menu
' Check to see if we have a the current offset value in EEPROM.
read 118, WORD W0
if W0=0 then
W0=500
write 118, WORD W0
end if
' Initialise the LCD display
FOR b11 = 0 TO 5
READ b11,b12
pause 15
GOSUB SendCmdByte
NEXT
FOR b11 = 93 TO 97 ' Display "Wait"
READ b11,b12
GOSUB SendDataByte
NEXT
' start up been and turn off outputs
gosub Beep
low C.5
low C.4
sleep 1 ' nap to give the amp ADC a chance to settle.

Main:
pause 288 ' Have a little sleep to save some power.
readadc10 0,W0 'Read in volts
poke 200,WORD W0 'Store
readadc10 1,W0 'Read in Amps
poke 202,WORD W0 'Store
gosub DisplayVolt
gosub DisplayAmp
gosub DisplayWatt
if pinC.1 = 1 then Menu1 ' Is menu button pressed?
if pinC.6 = 0 then OnLoad ' Is Forced Load switch on?
if pinC.7 = 0 then OnCharge ' Is Forced Charge switch on?
peek 200, WORD W0 'Get the volage
read 110, WORD W1 'Get the O/P 1 On level
if W0>W1 then 'Switch on O/P 1.
High C.4
B4=1
end if
read 112, WORD W1 'Get the O/P 1 Off level
if W0<W1 then 'Switch off O/P 1.
Low C.4
B4=0
end if
read 114, WORD W1 'Get the O/P 2 On level
if W0>W1 then 'Switch on O/P 2.
High C.5
B5=1
end if
read 116, WORD W1 'Get the O/P Off level
if W0<W1 then 'Switch off O/P 2.
Low C.5
B5=0
end if
peek 202, WORD W1
read 118, WORD W3
if W1>W3 then
W1=W1-W3
else
W1=0
end if
sertxd("[<V>", #W0, "</V><A>", #W1, "</A><OP1>", #B4, "</OP1><OP2>", #B5, "</OP2>]")
goto main

DisplayVolt:
b12 = 2
GOSUB SendCmdByte
Peek 200,WORD W0 'Get volt value
W1=W0/100
b12=W1+48
GOSUB SendDataByte
W1=W1*100
W0=W0-W1
W1=W0/10
b12=W1+48
GOSUB SendDataByte
b12 = 46
Gosub SendDataByte
W1=W1*10
W0=W0-W1
W1=W0
b12=W1+48
GOSUB SendDataByte
FOR b11 = 6 TO 8 ' Display "V"
READ b11,b12
GOSUB SendDataByte
NEXT
Return

DisplayAmp: ' Same as above, but adds the - and + symbols for current
Peek 202,WORD W0 ' Get Amp Reading
Read 118,WORD W3 ' Get Amp Offset
If W0>W3 then pamp
if W0<W3 then namp
if W0=W3 then oamp
goto d1
pamp:
W0=W0-W3
goto d1
namp:
b12=45
GOSUB SendDataByte
W0=W3-W0
goto d1
oamp:
W0=0
goto d1
d1:
W1=W0/100
b12=W1+48
GOSUB SendDataByte
W1=W1*100
W0=W0-W1
W1=W0/10
b12=W1+48
GOSUB SendDataByte
b12 = 46
Gosub SendDataByte
W1=W1*10
W0=W0-W1
W1=W0
b12=W1+48
GOSUB SendDataByte
FOR b11 = 9 TO 11 ' Display "A"
READ b11,b12
GOSUB SendDataByte
NEXT
Return

DisplayWatt:
Peek 202,WORD W1 ' Get Amps
Read 118,WORD W3 ' Get Amps Offset
if W1<W3 then
W1=W3
end if
Peek 200,WORD W0 ' Get Volts
b12 = 192
GOSUB SendCmdByte ' move to 2nd line
W1=W1-W3 ' Subtract the offset, and then we no longer need W3
W3=W0/10 ' Work out watts for peak watt
W3=W3*W1
W3=W3*10/97 ' yucky maths but works. We lost precision so need to fudge the figures. Will improve on this later.
Poke 206, WORD W3 ' Save for peaks watts test
if W1>200 then
W1=W1/10
W3=W0*W1
W0=W3
W1=W0/10000
b12=W1+48
GOSUB SendDataByte
W1=W1*10000
W0=W0-W1
W1=W0/1000
b12=W1+48
GOSUB SendDataByte
W1=W1*1000
W0=W0-W1
W1=W0/100
b12=W1+48
GOSUB SendDataByte
W1=W1*100
W0=W0-W1
W1=W0/10
b12=W1+48
GOSUB SendDataByte
b12 = 46
Gosub SendDataByte
W1=W1*10
W0=W0-W1
W1=W0
b12=W1+48
GOSUB SendDataByte
else
W3=W0*W1
W0=W3
W1=W0/10000
b12=W1+48
GOSUB SendDataByte
W1=W1*10000
W0=W0-W1
W1=W0/1000
b12=W1+48
GOSUB SendDataByte
W1=W1*1000
W0=W0-W1
W1=W0/100
b12=W1+48
GOSUB SendDataByte
b12 = 46
Gosub SendDataByte
W1=W1*100
W0=W0-W1
W1=W0/10
b12=W1+48
GOSUB SendDataByte
end if
FOR b11 = 12 TO 13 ' Display "W"
READ b11,b12
GOSUB SendDataByte
NEXT
Peek 204, WORD W0
Peek 206, WORD W1
if W1>W0 then
Poke 204, WORD W1
W0=W1
end if
W1=W0/100
b12=W1+48
GOSUB SendDataByte
W1=W1*100
W0=W0-W1
W1=W0/10
b12=W1+48
GOSUB SendDataByte
W1=W1*10
W0=W0-W1
W1=W0
b12=W1+48
GOSUB SendDataByte
FOR b11 = 15 TO 21 ' Display "Wpeak"
READ b11,b12
GOSUB SendDataByte
NEXT
Return

Menu1:
Read 110, WORD W0
Poke 208, WORD W0
Menu1a:
GOSUB Beep
pause 500
b12 = 1
GOSUB SendCmdByte
b12 = 128
GOSUB SendCmdByte
FOR b11 = 22 TO 30 'Display "O/P 1 On"
READ b11,b12
GOSUB SendDataByte
NEXT
Peek 208, WORD W0
Poke 200, WORD W0
gosub DisplayVoltLine2
Menu1b:
pause 100
Peek 208, WORD W0
if pinC.1 = 1 then Save1
if pinC.2 = 1 then
W0 = W0 + 1
Poke 208,WORD W0
Poke 200, WORD W0
gosub DisplayVoltLine2
end if
if pinC.3 = 1 then
W0 = W0 - 1
Poke 208,WORD W0
Poke 200, WORD W0
gosub DisplayVoltLine2
end if
goto Menu1b
Save1:
Peek 208, WORD W0
Write 110, WORD W0

Menu2:
Read 112, WORD W0
Poke 208, WORD W0
Menu2a:
GOSUB Beep
pause 500
b12 = 1
GOSUB SendCmdByte
b12 = 128
GOSUB SendCmdByte
FOR b11 = 31 to 40 'Display "O/P 1 Off"
READ b11,b12
GOSUB SendDataByte
NEXT
Peek 208, WORD W0
Poke 200, WORD W0
gosub DisplayVoltLine2
Menu2b:
pause 100
Peek 208, WORD W0
if pinC.1 = 1 then Save2
if pinC.2 = 1 then
W0 = W0 + 1
Poke 208,WORD W0
Poke 200, WORD W0
gosub DisplayVoltLine2
end if
if pinC.3 = 1 then
W0 = W0 - 1
Poke 208,WORD W0
Poke 200, WORD W0
gosub DisplayVoltLine2
end if
goto Menu2b
Save2:
Peek 208, WORD W0
Write 112, WORD W0

Menu3:
Read 114, WORD W0
Poke 208, WORD W0
Menu3a:
GOSUB Beep
pause 500
b12 = 1
GOSUB SendCmdByte
b12 = 128
GOSUB SendCmdByte
FOR b11 = 41 TO 49 'Display "O/P 2 On"
READ b11,b12
GOSUB SendDataByte
NEXT
Peek 208, WORD W0
Poke 200, WORD W0
gosub DisplayVoltLine2
Menu3b:
pause 100
Peek 208, WORD W0
if pinC.1 = 1 then Save3
if pinC.2 = 1 then
W0 = W0 + 1
Poke 208,WORD W0
Poke 200, WORD W0
gosub DisplayVoltLine2
end if
if pinC.3 = 1 then
W0 = W0 - 1
Poke 208,WORD W0
Poke 200, WORD W0
gosub DisplayVoltLine2
end if
goto Menu3b
Save3:
Peek 208, WORD W0
Write 114, WORD W0

Menu4:
Read 116, WORD W0
Poke 208, WORD W0
Menu4a:
GOSUB Beep
pause 500
b12 = 1
GOSUB SendCmdByte
b12 = 128
GOSUB SendCmdByte
FOR b11 = 50 TO 59 'Display "O/P 2 Off"
READ b11,b12
GOSUB SendDataByte
NEXT
Peek 208, WORD W0
Poke 200, WORD W0
gosub DisplayVoltLine2
Menu4b:
pause 100
Peek 208, WORD W0
if pinC.1 = 1 then Save4
if pinC.2 = 1 then
W0 = W0 + 1
Poke 208,WORD W0
Poke 200, WORD W0
gosub DisplayVoltLine2
end if
if pinC.3 = 1 then
W0 = W0 - 1
Poke 208,WORD W0
Poke 200, WORD W0
gosub DisplayVoltLine2
end if
goto Menu4b
Save4:
Peek 208, WORD W0
Write 116, WORD W0

Menu5:
GOSUB Beep
pause 500
b12 = 1
GOSUB SendCmdByte
b12 = 128
GOSUB SendCmdByte
FOR b11 = 60 TO 74 'Display "Zero amps offset"
READ b11,b12
GOSUB SendDataByte
NEXT
b12 = 192
GOSUB SendCmdByte
FOR b11 = 75 TO 83 'Display "Press UP"
READ b11,b12
GOSUB SendDataByte
NEXT
Menu5a:
pause 100
if pinC.1 = 1 then Start
if pinC.2 = 1 then ZeroAmp
goto Menu5a

ZeroAmp:
readadc10 1,W0
write 118,WORD W0
b12 = 192
GOSUB SendCmdByte
FOR b11 = 84 TO 92 'Display "Done "
READ b11,b12
GOSUB SendDataByte
NEXT
gosub beep
goto Menu5a

OnLoad:
gosub beep ' keep beeping to remind us the charger is in a manual state
High C.4
pause 580
High C.5
Goto Main

OnCharge:
gosub beep ' keep beeping to remind us the charger is in a manual state
low C.5
pause 580
low C.4
goto Main

DisplayVoltLine2:
b12 = 192
GOSUB SendCmdByte
W3=W0
W1=W3/100
b12=W1+48
GOSUB SendDataByte
W1=W1*100
W3=W3-W1
W1=W3/10
b12=W1+48
GOSUB SendDataByte
b12 = 46
Gosub SendDataByte
W1=W1*10
W3=W3-W1
W1=W3
b12=W1+48
GOSUB SendDataByte
FOR b11 = 6 TO 8 ' Display "V"
READ b11,b12
GOSUB SendDataByte
NEXT
Return

SendCmdByte:
b13 = %00000000 'Send to Command register
SendDataByte:
pinsB = b12 & %11110000 | b13 'Put MSB out first
PULSOUT B.3,2 'Give a 10uS pulse on E
pinsB = b12 * %00010000 | b13 'Put LSB out second
PULSOUT B.3,2 'Give a 10uS pulse on E
b13 = %00000100 'Send to Data register next
RETURN

Beep: 'Make a noise. this pin cant use any tone commands so we need to write our own
for b8=0 to 5
high C.0
pause 1
low C.0
pause 1
next
return



Sometimes it just works
 
scnarine
Newbie

Joined: 17/06/2011
Location: United States
Posts: 29
Posted: 02:21pm 22 Mar 2013
Copy link to clipboard 
Print this post

I just tried that code and it did not work...

I believe the version 2 code only works on the PICAXE-28x chip and NOT the PICAXE-28X1 or the 28X2 chips.

I found a temp sensor circuit and code and the commands are totally different for the LCD display

#picaxe 28x2

' Converted by X2 Conversion Wizard Version 2.0.5 (2010r4.1)

let dirsB = %11111111
let adcsetup = 0

; ============================================================ =====
; author: Goran Poprzen
; filename: lcd-temp-0.7.bas
; target: picaxe28x1
; date: Jan 5, 2009
; version: 0.7
; description: Measures the temperature with DS18B20 temp. sensor
; and shows on the 2x16 char LCD display,
; also sends to the serial terminal, and
; checks against the limits and sets the output accordingly:
; high if temp. is lower then higher limit,
; low if temp. is higher then lower limit.
; Confusing, eh? Not really!
; ============================================================ =====

; picaxe28x1 variables
; bit0-31, b0-27, w0-13

; variables used here:

symbol lcdchar = b4
symbol lcdtmp = b5
symbol counter = b6

symbol position = b7
symbol tenths = b8
symbol ones = b9

; 16-bit measured temperature
symbol temp12 = w5
symbol temp12lo = b10
symbol temp12hi = b11

; 16-bit lower temp. limit
symbol TL = w6
symbol TLlo = b12
symbol TLhi = b13

; 16-bit higher temp. limit
symbol TH = w7
symbol THlo = b14
symbol THhi = b15

; status of the output pin
symbol LED = bit0

; greetings message
eeprom 0,("GPtronics 2010Thermometer")























; two decimal digits rounding
; eeprom 32,("00061219253137445056626975818794")

; four decimal digits - not rounded
eeprom 32,("0000062512501875250031253750437550005625625068757500812 587509375")

; ============================================================ =====

main: ; executed at the beginning
gosub taketemp ; first measuring to determine initial status of the output relay
gosub init
gosub lcdinit ; initialization of the lcd display
gosub hello ; greeting message - just for fun :)

main2: ; loop
gosub taketemp ; temperature measuring
gosub checklimits ; checks measured temp. against limits and sets output accordingly
gosub sendtemp ; sends data to rs-232
gosub showtemp ; converts numbers and shows them on lcd

goto main2 ; loop again

; ============================================================ =====

init:
counter = 0

TLhi = 22 ; lower temperature limit
TLlo = 0
THhi = 24 ; higher temperature limit
THlo = 0

if temp12 <= TH then : gosub ledon : else : gosub ledoff : endif

return

; ============================================================ =====

lcdinit:
pinsB = 0
pause 200

pinsB = 48
gosub pulsing
gosub pulsing
gosub pulsing

pinsB = 32
gosub pulsing
gosub pulsing

pinsB = 128
gosub pulsing

lcdchar = 14
gosub wrins

lcdchar = 12
gosub wrins

return

pulsing:
pulsout B.3,6
pause 10
return

; ============================================================ =====

wrchr:
pinsB = lcdchar & 240
high B.2
pulsout B.3,2
lcdtmp = lcdchar * 16
pinsB = lcdtmp & 240
high B.2
pulsout B.3,2
return

wrins:
pinsB = lcdchar & 240
pulsout B.3,2
lcdtmp = lcdchar *16
pinsB = lcdtmp & 240
pulsout B.3,2
high B.2
return

; ============================================================ =====

hello:
lcdchar = 1
gosub wrins

lcdchar = 12
gosub wrins

for counter = 0 to 13
read counter, lcdchar
gosub wrchr
next counter

lcdchar = 192
gosub wrins

for counter = 14 to 24
read counter, lcdchar
gosub wrchr
next counter

pause 1000

lcdchar = 1
gosub wrins

return

; ============================================================ =====

taketemp:
readtemp12 C.7, temp12
temp12 = temp12 * 16
temp12lo = temp12lo / 16
return

; ============================================================ =====

sendtemp:






sertxd("Temp= ",#temp12,13,10)
sertxd("TH= ",#TH,13,10)
sertxd("TL= ",#TL,13,10)
return

; ============================================================ =====

showtemp:
lcdchar = 2
gosub wrins

lcdchar = temp12hi / 100
if lcdchar = 0 then leadzero
lcdchar = lcdchar + 48
goto nonleadzero
leadzero:
lcdchar = lcdchar + 32
nonleadzero:
tenths = temp12hi // 100
gosub wrchr ; write 100s

lcdchar = tenths / 10
lcdchar = lcdchar + 48
ones = tenths // 10
gosub wrchr ; write 10s

lcdchar = ones
lcdchar = lcdchar + 48
gosub wrchr ; write 1s

lcdchar = "."
gosub wrchr

for counter = 0 to 3
position = temp12lo * 4 + 32 + counter
read position, lcdchar
gosub wrchr
next counter

lcdchar = 178
gosub wrchr

lcdchar = "C"
gosub wrchr

return

; ============================================================ =====

checklimits:

if LED = 1 and temp12 > TH then gosub ledoff

if LED = 0 and temp12 < TL then gosub ledon

return

; ============================================================ =====

ledoff:
low C.1
LED = 0
return

ledon:
high C.1
LED = 1
return

However, this code loads ok and works...My LCD initialize.



Can you or anyone you know have a revolution programmer that can convert basic to assembler. I have PIC16F873A that I can try if the code is converted it may work....
 
scnarine
Newbie

Joined: 17/06/2011
Location: United States
Posts: 29
Posted: 03:23pm 22 Mar 2013
Copy link to clipboard 
Print this post

I was able to convert Version 1 code and it works perfectly on PICAXE-28X2 (PIC18F25K22)...but I cannot do the same with version 2 code... see below PICAXE-28X2 (PIC18F25K22) version 1 code that works.

#picaxe 28x2

' Converted by X2 Conversion Wizard Version 2.0.5 (2010r4.1)

let dirsB = %11111111
let adcsetup = %00000011 ' For PICAXE-28X2 (18F25K22)
' adcsetup = %00000011 ' For PICAXE-28X2-3V (18F25K20)
' adcsetup = 2 ' For PICAXE-28X2-5V (18F2520)

' Charge Controller
' Ver 2006C
' www.thebackshed.com

Start:
SYMBOL Amp = b4 ; Measured Battery Amps
SYMBOL Volt = b6 ; Measured Battery Volts
SYMBOL CVolt = b7 ; Charging Voltage Level
SYMBOL LVolt = b8 ; Load Voltage Level
SYMBOL LBatt = b9 ; Low Battery Alarm Level

EEPROM 0,( $33 )
EEPROM 1,( $32 )
EEPROM 2,( $28 )
EEPROM 3,( $0C )
EEPROM 4,( $06 )
EEPROM 5,( $01 )
EEPROM 6,("V ")
EEPROM 9,("A ")
EEPROM 16,("CHARGING")
EEPROM 24,("ON LOAD ")
EEPROM 32,("Set Load Volts")
EEPROM 46,("Set Charge Volts")
EEPROM 62,("Forced Load")
EEPROM 73,("Forced Charge")
EEPROM 86,("LOW BATT")
EEPROM 94,("Set Low Batt")

read 120,CVolt ' read in Charge volt level saved in eeprom
read 121,LVolt ' read in Load volt level saved in eeprom
read 122,LBatt ' read in Low Battery volt level saved in eeprom
FOR b11 = 0 TO 5 ' Initialise the LCD display
READ b11,b12
pause 15
GOSUB SendCmdByte

NEXT
b12=1 ' set controler to charging mode
Gosub SendCmdByte
b12 = 192
GOSUB SendCmdByte
FOR b11 = 16 TO 23
READ b11,b12
GOSUB SendDataByte

NEXT
gosub Beep
low c.5
high c.4
if LVolt=0 then DefaultVolt
goto main

DefaultVolt:
' This routine sets some default voltages if there are no preset values in the eeprom
LVolt=40 ' Set default load voltage to 14.0
write 121,LVolt ' save to eeprom
CVolt=22 ' Set default charge voltage to 12.2
write 120,CVolt ' save to eeprom
LBatt=12 ' Set default low batt voltage to 11.2
write 122,LBatt ' save to eeprom


' ########## Main battery regulating routine


Main:
Pause 300 ' Have a little sleep to save some power.
gosub GetValues
if pinC.1 = 1 then menu1 ' Is menu button pressed?
if pinC.6 = 0 then OnLoad ' Is Forced Load switch on?
if pinC.7 = 0 then OnCharge ' Is Forced Charge switch on?
sertxd("<V=", #volt, ",A=", #Amp, ">") ' send the data back via the serial port to the PC for logging.
B5 = Volt
b12 = 2
Gosub SendCmdByte
gosub DisplayVolt
FOR b11 = 6 TO 8 ' Display "V"
READ b11,b12
GOSUB SendDataByte

NEXT
gosub DisplayAmp
FOR b11 = 9 TO 11 ' Display "A"
READ b11,b12
GOSUB SendDataByte

NEXT
if Volt<LBatt then LowBattAlarm 'Low volts, sound alarm
if Volt>LVolt then SwitchToLoad 'Battery fully charged, switch windmill to Load.
if Volt<CVolt then SwitchToCharging 'Battery b11ting low, switch windmill to Battery.
goto main


' ########## Send info to the screen routine.


SendCmdByte:
b13 = %00000000 ; Send to Command register

SendDataByte:
pinsB = b12 & %11110000 | b13 ; Put MSB out first
PULSOUT B.3,2 ; Give a 10uS pulse on E
pinsB = b12 * %00010000 | b13 ; Put LSB out second
PULSOUT B.3,2 ; Give a 10uS pulse on E
b13 = %00000100 ; Send to Data register next
RETURN


' ########## Read in values for Volts and Amps


GetValues:
readadc10 0,w0 ' read in volts
' trim down to a range of 100 to 355.
' ie if it was less than 100, it bcomes 100.
` ' if it was over 355, it becomes 355.
' this gives us a voltage range of 10.0 to 35.5.
let w0=w0 min 100
let w0=w0 max 355
' As we can only use bytes, we take off 100 to give us a range of 0 to 255.
' 0 = 10 volts, 255 = 35.5 volts
Volt = w0 - 100
readadc10 1, w0 ' Reads in Amps
let w0=w0 min 300
let w0=w0 max 555
' As above, but this time 0=-128 amps, 128=0 amps, 255=128 amps.
' remember we want to read plus and minus amps
Amp = w0-300
Return


' ########## Low Battery Voltage alarm.


LowBattAlarm:
gosub Beep ' Make a noise!
low C.5 ' Make sure controller is in charge mode
high C.4
b12 = 192 ' move to 2nd line on screen
GOSUB SendCmdByte
FOR b11 = 86 TO 93
READ b11,b12
GOSUB SendDataByte ' Display "Low Batt"

NEXT
sleep 300 ' Have a little sleep.
goto Main


' ########## Swift from Charging to Load and visa-versa


SwitchToLoad:
b12 = 192 ' move to 2nd line on screen
GOSUB SendCmdByte
FOR b11 = 24 TO 31
READ b11,b12
GOSUB SendDataByte ' Display "On Load"

NEXT
Low C.4 ' Turn off MOSFETS to battery.
High C.5 ' Turn on MOSFETS to dummy load
goto Main

SwitchToCharging:
b12 = 192 ' move to 2nd line on screen
GOSUB SendCmdByte
FOR b11 = 16 TO 23
READ b11,b12
GOSUB SendDataByte ' Display "Charging"

NEXT
low C.5 ' Turn off MOSFETS to dummy load
high C.4 ' Turn on MOSFETS to battery.
goto Main


' ########## Display Volts and Amps routine


DisplayVoltLine2:
b12 = 192
GOSUB SendCmdByte
DisplayVolt: ' the routine breaks up the voltage into individual numbers and displays each in turn
b10=b5/100
b12=b10+49
GOSUB SendDataByte
b10=b10*100
b5=b5-b10
b10=b5/10
b12=b10+48
GOSUB SendDataByte
b12 = 46
Gosub SendDataByte
b10=b10*10
b5=b5-b10
b10=b5
b12=b10+48
GOSUB SendDataByte
Return

DisplayAmp: ' Same as above, but adds the - and + symbols for current

If Amp>128 then pamp
if Amp<128 then namp
if Amp=128 then oamp
goto d1
pamp:
Amp=Amp-128
goto d1
namp:
b12=45
GOSUB SendDataByte
Amp=128-Amp
goto d1
oamp:
Amp=0
goto d1
d1:
b5=amp
b10=b5/100
b12=b10+48
GOSUB SendDataByte
b10=b10*100
b5=b5-b10
b10=b5/10
b12=b10+48
GOSUB SendDataByte
b12 = 46
Gosub SendDataByte
b10=b10*10
b5=b5-b10
b10=b5
b12=b10+48
GOSUB SendDataByte
Return


' ######## Setup menu routine


Menu1: 'Set the Charge Voltage "CVolt"
GOSUB Beep
pause 500
b12 = 1
GOSUB SendCmdByte
b12 = 128
GOSUB SendCmdByte
FOR b11 = 46 TO 61 'Display "Set Charge Volts"
READ b11,b12
GOSUB SendDataByte

NEXT
b5 = CVolt
gosub DisplayVoltLine2
Menu1a:
pause 100
if pinC.1 = 1 then Menu2
if pinC.2 = 1 then UpChargeVolt
if pinC.3 = 1 then DownChargeVolt
goto Menu1a

UpChargeVolt:
CVolt = CVolt + 1
b5 = CVolt
gosub DisplayVoltLine2
write 120,CVolt 'save in eeprom
goto Menu1a

DownChargeVolt:
CVolt = CVolt - 1
b5 = CVolt
gosub DisplayVoltLine2
write 120,CVolt 'save in eeprom
goto Menu1a

Menu2: 'Set the Load Voltage "LVolt"
GOSUB Beep
pause 500
b12 = 1
GOSUB SendCmdByte
b12 = 128
GOSUB SendCmdByte
FOR b11 = 32 TO 45 'Display "Set Load Volts"
READ b11,b12
GOSUB SendDataByte

NEXT
b5 = LVolt
gosub DisplayVoltLine2
Menu2a:
pause 100
if pinC.1 = 1 then Menu3
if pinC.2 = 1 then UpLoadVolt
if pinC.3 = 1 then DownLoadVolt
goto Menu2a

UpLoadVolt:
LVolt = LVolt + 1
b5 = LVolt
gosub DisplayVoltLine2
write 121,LVolt 'save in eeprom
goto Menu2a

DownLoadVolt:
LVolt = LVolt - 1
b5 = LVolt
gosub DisplayVoltLine2
write 121,LVolt 'save in eeprom
goto Menu2a

Menu3: 'Set the Low Batt alarm voltage "LBatt"
GOSUB Beep
pause 500
b12 = 1
GOSUB SendCmdByte
b12 = 128
GOSUB SendCmdByte
FOR b11 = 94 TO 105 'Display "Set Low Batt"
READ b11,b12
GOSUB SendDataByte

NEXT
b5 = LBatt
gosub DisplayVoltLine2
Menu3a:
pause 100
if pinC.1 = 1 then Start
if pinC.2 = 1 then UpLBattVolt
if pinC.3 = 1 then DownLBattVolt
goto Menu3a

UpLBattVolt:
LBatt = LBatt + 1
b5 = LBatt
gosub DisplayVoltLine2
write 122,LBatt 'save in eeprom
goto Menu3a

DownLBattVolt:
LBatt = LBatt - 1
b5 = LBatt
gosub DisplayVoltLine2
write 122,LBatt 'save in eeprom
goto Menu3a


' ########## Forced Charge / Load routines.

' The following routines work the same way as the "Main" loop, except that the controler state is fixed.
OnLoad:

gosub beep

OnLoad1:


Low C.4
High C.5
sleep 300
gosub GetValues
if pinC.6 = 1 then Start
sertxd("<V=", #volt, ",A=", #Amp, ">")
B5 = Volt
b12 = 2
Gosub SendCmdByte
gosub DisplayVolt
FOR b11 = 6 TO 8
READ b11,b12
GOSUB SendDataByte
NEXT
gosub DisplayAmp
FOR b11 = 9 TO 11
READ b11,b12
GOSUB SendDataByte

NEXT
' Display "Forced Load"
b12 = 192
GOSUB SendCmdByte
FOR b11 = 62 TO 72
READ b11,b12
GOSUB SendDataByte

NEXT

Goto OnLoad1

OnCharge:

gosub beep

OnCharge1:

low C.5
high C.4
sleep 300
gosub GetValues
if pinC.7 = 1 then Start
sertxd("<V=", #volt, ",A=", #Amp, ">")
B5 = Volt
b12 = 2
Gosub SendCmdByte
gosub DisplayVolt
FOR b11 = 6 TO 8
READ b11,b12
GOSUB SendDataByte

NEXT
gosub DisplayAmp
FOR b11 = 9 TO 11
READ b11,b12
GOSUB SendDataByte

NEXT
' Display "Forced Charge"
b12 = 192
GOSUB SendCmdByte
FOR b11 = 73 TO 85
READ b11,b12
GOSUB SendDataByte
NEXT

goto OnCharge1

Beep: 'Make a noise
for b3=1 to 8
high C.0
pause 1
low C.0
pause 1
next
returnEdited by scnarine 2013-03-24
 
Downwind

Guru

Joined: 09/09/2009
Location: Australia
Posts: 2333
Posted: 03:38pm 22 Mar 2013
Copy link to clipboard 
Print this post

Thats good, although i dont see where the difference is, as both sets of code uses exactly the same code for the LCD.
Sometimes it just works
 
scnarine
Newbie

Joined: 17/06/2011
Location: United States
Posts: 29
Posted: 02:14am 23 Mar 2013
Copy link to clipboard 
Print this post

Then it might not be a problem with the LCD wiring or LCD coding.

Do you or anyone you know have a revolution programmer that can convert basic to assembler. I have PIC16F873A that I can try, if the code is converted it may work....

 
scnarine
Newbie

Joined: 17/06/2011
Location: United States
Posts: 29
Posted: 10:04am 23 Mar 2013
Copy link to clipboard 
Print this post

I don't understand any of this programming, I wish I knew what to do to make this project work. I search the internet for PICAXE-28X and could not find one. I order one on ebay the description for $28.00 http://www.ebay.com/itm/PicAxe-28X-Chip-Microcontroller-Inte grated-Circuit-/300852199852?pt=UK_BOI_Electrical_Components _Supplies_ET&hash=item460c3041ac


I don't believe it is correct.

 
Downwind

Guru

Joined: 09/09/2009
Location: Australia
Posts: 2333
Posted: 04:34pm 23 Mar 2013
Copy link to clipboard 
Print this post

Rev-Ed the maker of picaxe still list the 28x1 chip, its old stock now so no one will stock them because who wants to buy a lesser chip when they can buy a 28x2 chip with far more functions, so its only available from Tech supplies here.

http://www.techsupplies.co.uk/epages/Store.sf/en_GB/?ObjectP ath=/Shops/Store.TechSupplies/Categories/PICAXE/PICAXEChips/ PICAXEChips1

Or you could ask on the Picaxe forum, if someone has a 28x1 chip they will part with, more than likely several might offer a old 28x1 chip for free if you pay the postage, just remember to state your location as there may be someone local to you with a chip.
Many of us end up with a draw full of older version chips we simply may never use in a project, because the newer version chips are so much better.

http://www.picaxeforum.co.uk/forum.php
Sometimes it just works
 
scnarine
Newbie

Joined: 17/06/2011
Location: United States
Posts: 29
Posted: 07:13pm 23 Mar 2013
Copy link to clipboard 
Print this post

Mr. Pete/Downwind, I do have a PICAXE-28X1 (PIC16F886) and the same exact thing happened when I put version 2 code on the chip, but version 1 code works perfect. This leaves me to think that something is wrong with version 2 code, or version 2 code requires a different wiring to the LCD or the LCD itself.

Mr. Gizmo's is there a data sheet or a part # of the LCD you used on version 2? and could you please post a picture of your LCD wiring.

Thanks

Sudesh
 
scnarine
Newbie

Joined: 17/06/2011
Location: United States
Posts: 29
Posted: 02:50am 24 Mar 2013
Copy link to clipboard 
Print this post

Does version 2 needs this code?

SYMBOL Amp = b4 ; Measured Battery Amps
SYMBOL Volt = b6 ; Measured Battery Volts
SYMBOL CVolt = b7 ; Charging Voltage Level
SYMBOL LVolt = b8 ; Load Voltage Level
SYMBOL LBatt = b9 ; Low Battery Alarm Level

it is listed in version 1
 
scnarine
Newbie

Joined: 17/06/2011
Location: United States
Posts: 29
Posted: 03:30am 24 Mar 2013
Copy link to clipboard 
Print this post

I think Gizmo's uses the Peek/Poke command in Version 2. where the location are different in X2 and X1 chips...I believe this is the issue and not the lCD.


Name:
peek
Syntax:

PEEK location,variable,variable,WORD wordvariable...

Location - is a variable/constant specifying a register address.

Variable - is a byte variable where the data is returned. To use a word variable the keyword WORD must be used before the wordvariable name.
Description:

Read data from the microcontroller RAM registers. This allows use of additional storage variables not defined by the bxx variables.

For non M2/X2 parts

The function of the poke/peek commands is two fold. The most commonly used function is to store temporary byte data in the microcontrollers spare 'storage variable' memory. This allows the general purpose variables (b0, b1 etc.) to be re-used in calculations.
Addresses $50 to $7E are general purpose registers that can be used freely
Addresses $C0 to $EF can also be used by PICAXE-18X
Addresses $C0 to $FF can also be used by PICAXE-28X, 40X
Addresses $C0 to $EF can also be used by PICAXE-28X1, 40X1

The second function of the peek command is for experienced users to study the internal microcontroller SFR (special function registers).

Addresses $00 to $1F and $80 to $9F are special function registers (e.g. PORTB) which determine how the microcontroller operates. Avoid using these addresses unless you know what you are doing! The command uses the microcontroller FSR register which can address register banks 0 and 1 only.

Addresses $20 to $4F and $A0 to $BF are general purpose registers reserved for use with the PICAXE bootstrap interpreter. Poking these registers will produce unexpected results and could cause the interpreter to crash.

When word variables are used (with the keyword WORD) the two bytes of the word are saved/retrieved in a little endian manner (ie low byte at address, high byte at address + 1).

For M2 parts

The function of the poke/peek commands is amended on M2 parts.

The M2 parts have up to 512 bytes of user RAM.

The peek and poke commands are used to read and write to all 256 bytes of the user RAM. However the lower 28 bytes (addresses 0 to 27) also correspond to the variables b0 to b27. Therefore these lower bytes can be accessed in two ways, via the bxx variable name or via the peek/poke command. The higher variables can only be accessed via the peek/poke commands.

See the peeksfr and pokesfr commands for details on how to access the internal microcontroller SFR (special function registers).

Note that on the 18M2 part bytes 128-255 are reserved during parallel multi-tasking mode (they are freely available in single task mode). This is a restriction of the limited available RAM on this particular part and does not apply to the 14M2/20M2 parts.

For X2 parts

The function of the poke/peek commands is amended on X2 parts.

The 20X2 parts have 128 bytes of user RAM (+128 more in scratchpad)

The 28X2 parts have 256 bytes of user RAM (+1024 more in scratchpad)

The 40X2 parts have 256 bytes of user RAM (+1024 more in scratchpad)

The peek and poke commands are used to read and write to all 256 bytes of the user RAM. However the lower 56 bytes (addresses 0 to 55) also correspond to the variables b0 to b55. Therefore these lower bytes can be accessed in two ways, via the bxx variable name or via the peek/poke command. The higher variables can only be accessed via the peek/poke commands.

See the peeksfr and pokesfr commands for details on how to access the internal microcontroller SFR (special function registers).
 
scnarine
Newbie

Joined: 17/06/2011
Location: United States
Posts: 29
Posted: 05:56am 24 Mar 2013
Copy link to clipboard 
Print this post

Well Guys I would like to Thank you both Mr. Glen and Mr. Pete for your time and effort, I have learned a lot about picaxe..(not really an expert yet I am still in kindergarden) Well The good news the circuit and Version 2 code is working so far. so here is what I did so far.

A few years ago I used sprint layout and create the PCB I also purchase PICAXE-28X1 and X2 chip. Last year I used my CNC machine and Finally mill the board and drill the holes. This Year I assembled the board. A few weeks ago I attempt to program the chip. So I started out getting syntax errors since I jumped straight into the 28X2 chip so I revert back to the 28X1 chop and program it with version 1 then tried version 2 code, well that was not a good idea...because you will get a bunch of weird characters on the LCD like I was getting. I would like to apologize to Mr Glen and Mr. pete for wasting their time with me for my silly mistake.

However, This is what I did to make it work. I found a different code ( temp sensor picaxe project) I loaded that code (trial and error while I was testing my LCD wiring configuration) which changes the chip completely. An erase chip function would have also done the trick. I then program the chip again and the notice the LCD display "O/P 1 On 00.0V I then decide to hit the menu button and play around. I then decide to play around with the values then realized I have to set the values so I did and as I exit the menu I see "wait" and then wola the darn thing display correct "12.0v, 00.0A, 000.00W 000Wmax"

1. Do not program version 1 code then version 2 code over version1.
2. Do not disconnect or reset power to chip/circuit (if you do the characters might get messed up on reboot) without going through the initial setup menu by entering values, by just going through the menu will not exit and you are stuck. Version 1 have defaults setup for you.


Thanks again guys....
Sudesh.Edited by scnarine 2013-03-25
 
scnarine
Newbie

Joined: 17/06/2011
Location: United States
Posts: 29
Posted: 10:03am 24 Mar 2013
Copy link to clipboard 
Print this post

Mr. Glen/Gizmo or Mr. Pete/Downwind,
I have one more question. If I wanted to reverse the on and off on O/P 1 to work as a dump controller and stop charging completely until the bat voltage drop to a certain value, then turn back on. What I need to do?

ORIGINAL:
peek 200, WORD W0 'Get the volage
read 110, WORD W1 'Get the O/P 1 On level
if W0>W1 then 'Switch on O/P 1.
High portc 4
B4=1
end if
read 112, WORD W1 'Get the O/P 1 Off level
if W0<W1 then 'Switch off O/P 1.
Low portc 4
B4=0

Do I just change it like example below.
EXAMPLE:
peek 200, WORD W0 'Get the volage
read 112, WORD W1 'Get the O/P 1 off level
if W0<W1 then 'Switch off O/P 1.
Low portc 4
B4=0
end if
read 110, WORD W1 'Get the O/P 1 On level
if W0>W1 then 'Switch on O/P 1.
High portc 4
B4=1

Thanks
Sudesh.
 
     Page 2 of 3    
Print this page
© JAQ Software 2024