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 1 of 3 | |||||
Author | Message | ||||
indraneelkulkar Newbie Joined: 14/07/2009 Location: IndiaPosts: 5 |
Hi Glenn, Bro i need your help regarding the picaxe 28x, as i am ordering the controller these ppls are asking me for the full ic no. of the controller can you please help me out with the ic no. as well as can you also can you help me out with the Pin No. 9 and 10 whats that exactely. a piezo speaker or something else. Awating your reply. |
||||
Downwind Guru Joined: 09/09/2009 Location: AustraliaPosts: 2333 |
Hi indraneelkulkar, The picaxe 28x is a "Picaxe 28X" otherwise it would be a blank pic 16F873. The blank pic can not be used as a picaxe. You will need to buy a picaxe 28X or rewrite the code in pic language and have a dedicated programmer board to program the blank pic with. Best to just buy the picaxe to start with. I think the 28X is now superseded by the 28X1 picaxe and you might need to buy this one instead. It will work pin for pin and with the same code as the 28X The 28X requires a crystal ( or resonator) for the frequency and the crystal is connected to pin 9 and 10. Normally the frequency is 4Mhz but a 8 or 16 Mhz resonator can be used. ( i think Glenn used 4 Mhz) Have a look in the data in the help section of "picaxe programming editor" that is a free download from the net and is also the software used to program a picaxe with. You will need it anyhow. There is a lot of information in programming editor. Pete. Sometimes it just works |
||||
indraneelkulkar Newbie Joined: 14/07/2009 Location: IndiaPosts: 5 |
Thanx for the Help Bro. i will surely check it out and start my trials, Bro can i use the said 16f873 and get it programmed with the code used by Mr. Glenn and start on the work or i have to rewrite the programme ? Awating your reply. |
||||
Janne Senior Member Joined: 20/06/2008 Location: FinlandPosts: 121 |
Hi, pic16f873 won't do. The picaxe 28x is based on the pic16f873 microcontroller, but there are some additional stuff already installed there. (Hence making it a picaxe) Like Pete mentioned, the picaxe28x is now obsolete. The 28x1 is also old stock, it's been superseded by 28x2, but at the moment both are still available. You can buy the chips directly (or tell the guy that is making the board to order) from the manufacturer, or from a vendor. I'll post a link to the manufacturer's site. http://www.rev-ed.co.uk/picaxe/ If at first you don't succeed, try again. My projects |
||||
Downwind Guru Joined: 09/09/2009 Location: AustraliaPosts: 2333 |
You can take the progran written by Gizmo (Glenn) and dump it straight into the picaxe and it should work. You "cannot" do this with a pic as Janne said. To use the pic you would have to rewrite the code in pic code, which is very different and more difficult. Stick with using a Picaxe as i would think that might be challenging enough for you. You will still need to be able to make some changes to Gizmo's code yourself to set up some of the operations. Pete. Ps. Im not your Bro. Sometimes it just works |
||||
indraneelkulkar Newbie Joined: 14/07/2009 Location: IndiaPosts: 5 |
Hi, Picaxe-28x is Superseded by 28X1 is PIC16F873A i have heard from here http://groups.google.co.in/group/sci.electronics.design/brow se_thread/thread/2bbc77623c6eef35/54201cba87cc1a8f?pli=1 and pic16f873a is ordered by me today so will try to write the code lets see what happens. GOD IS GR8. Thx. Dear Downwind i know ur not my Bro. thats my style to call every1. sry if that hurted You. |
||||
Janne Senior Member Joined: 20/06/2008 Location: FinlandPosts: 121 |
Picaxe 28x1 IS NOT the same as pic16f873A, and you cannot program the pic16f873A as you would the picaxe. The picaxe 28x1 chip has already a "bootstrapping" program inside the chip, which makes it easy to write code and to program. With the pic you just ordered you will have to start from the bottom. The picaxe programming cable won't work for the pic16f873A, you will need a special programmer for that. If at first you don't succeed, try again. My projects |
||||
Downwind Guru Joined: 09/09/2009 Location: AustraliaPosts: 2333 |
I think you are trying to be cheap by ordering the pic16f873A. In the long run you will cost yourself 10 times more than the cost of the picaxe by the time you buy a programmer for the pic etc. Then you need to write the code and not many here will be able to help you with the pic code. As Janne and myself have been trying to tell you stick with buying the right chip to start with. Best advice i think is throw the pic in the bin and buy the picaxe. From the questions you have asked would indicate you have little knowledge of programming micros and if this is the case you will find the pic a daunting task to program. This is one of the main reason Gizmo used the picaxe in the first place and not because he was to lazy to write the pic code, but for the reason it is simple to use and allows others to learn and program it without the need for a fancy programmer and a brain bending time of trying to understand pic code. Wish you luck. Pete. Sometimes it just works |
||||
indraneelkulkar Newbie Joined: 14/07/2009 Location: IndiaPosts: 5 |
Hi, Thanx Pete i am not trying to be cheap well i tried to buy picaxe online, where i found that the cost of 3 picaxe 20.47 pounds and the transport is costing me 108.32 pounds thats why i was trying to go with pic, well when u suggest i will stick to the same picaxe28x only. Thx. |
||||
GWatPE Senior Member Joined: 01/09/2006 Location: AustraliaPosts: 2127 |
Picaxe micro's are available from Microzed computers in Australia. I am sure the postage would be less than you have been quoted from England. The 28X2 are around $20, but check the website www.microzed.com.au Gordon. become more energy aware |
||||
Downwind Guru Joined: 09/09/2009 Location: AustraliaPosts: 2333 |
Shop around, but the price you quoted is about right for 3 X 28X ( shipping looks a little high) For your interest a local dealer called MicroZed list the 28X2 for$20.00 Aud http://www.microzed.com.au/28pin.htm or eBay at Ebay The picaxe is not a cheap chip as you pay for the inbuilt bootstrap program that makes them a easy chip to use, and to be realistic we would not tackle these projects without the inbuilt features of the picaxe to start with. As for what picaxe to use, -- any in the 28X range will work fine. (28X, 28X1, 28X2) any above the 28X is backwards compatible to the 28X and will work the same as a 28X. Sorry if i was a little blunt in a previous post but could see your ambitions being greater than what i see your ability to be and would rather point it out rather than see you go down a path of little hope with a greater cost. Pete. Sometimes it just works |
||||
indraneelkulkar Newbie Joined: 14/07/2009 Location: IndiaPosts: 5 |
hi pete, the ics that i ordered are on their way as those were not cancelled, a gud news is that in india i found a gud programmer and hez ready to support us 4 completion of the project so trying to go up with pic16f873A ic, Another is that i have found a friend in Us who is dispatching the Picaxe28x2 by tom morning to me. |
||||
Downwind Guru Joined: 09/09/2009 Location: AustraliaPosts: 2333 |
The bottom line is the pic is a much faster chip than the picaxe even though they are one of the same. If you can use the pic with some help than you will end up with a cheaper system and a faster processing speed. The down side is you dont need the speed in this case and is much more complicated to use. It is a blank chip so needs to be configured as well as programmed. I to went the path of thinking the pic was a easier option till it came to programming it and soon learned the problems that one can encounter. For simple jobs with not the speed of processing needed i still rather use a picaxe at the slightly higher price. What i would recommend is you get it all working using the picaxe chip and then look to change the chip over to the pic. If you use a ic socket it should just unplug and swap over. ( dont be silly and not use a ic socket on a micro) At least then you will know if you have your pic code right to operate correctly. Dont forget where this idea all started from, and the work Gizmo has done to give this system free to all who would like to build it. The whole idea behind this 4m is to share information free of charge. So if you do get this written to pic code than please post the code for others to follow. ( ensure you have all the bugs out of it first) Keep us posted of your progress and results. Good luck with your project. Pete. Sometimes it just works |
||||
scnarine Newbie Joined: 17/06/2011 Location: United StatesPosts: 29 |
@Downwind..."As for what picaxe to use, -- any in the 28X range will work fine. (28X, 28X1, 28X2) any above the 28X is backwards compatible to the 28X and will work the same as a 28X. " I am trying to program Gizmo's charge controller on a 28X2 chip and I am unable to do so. His version 1 code works after I convert it and remove the nap command and replace it with sleep. But the version 2 code display rubbish/gibberish on the LCD. |
||||
Downwind Guru Joined: 09/09/2009 Location: AustraliaPosts: 2333 |
You could try this code, its untested but a revised version of Gizmo's code of version 2, to suit a 28x2 chip. I simply corrected all the syntax errors to the best of my understanding of the circuit. ' Charge Controller
' Ver 2010B ' 28X chip ' www.thebackshed.com #picaxe 28x2 Start: 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 ") ' 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 pause 2300 ' nap to give the amp ADC a chance to settle. Main: pause 300 ' 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 600 High c.5 Goto Main OnCharge: gosub beep ' keep beeping to remind us the charger is in a manual state low c.5 pause 600 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 3,1 'Give a 10uS pulse on E pinsB = b12 * %00010000 | b13 'Put LSB out second PULSOUT 3,1 '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 |
||||
Gizmo Admin Group Joined: 05/06/2004 Location: AustraliaPosts: 5078 |
Thanks for that Pete. I dont have a 28x2 chip to test the old code on either, so I'm afraid I cant help much. All i can suggest is work the problem. If version 1 of the code works, but not version 2, then look at the differences and try a few changes to the version 2 code to see if you can get it working on the new chip. Remember most of the projects on the site are there to inspire and modify. I usually build something to a stage that works for me, share it on the web site, and move on. Anyone who knows me knows how much I hate revisiting old projects. Glenn The best time to plant a tree was twenty years ago, the second best time is right now. JAQ |
||||
Downwind Guru Joined: 09/09/2009 Location: AustraliaPosts: 2333 |
If the code works for a 28x2 chip then get back and tell us, as if its proven to work Glenn might add it as a revision to the project. Unless its tested and bug free you can understand then its no point in adding a broken set of code to a project. Pete. Sometimes it just works |
||||
scnarine Newbie Joined: 17/06/2011 Location: United StatesPosts: 29 |
I just load that code posted by Pete (Downwind) and it did not work, I get solid boxes in the first line of the LCD as if the chip is blank. It is after midnight here so I will try and compare your work Mr. Pete with the original from Mr. Gizmo and the one I converted using the program editor. I really like this controller and would be very happy if I can get it to work.... So far I have a PICAXE-X1 (PIC16F886) chip and a PICAXE-28X2 (PIC18F25K22). Version 1 code will work fine on the PICAXE-X1 (PIC16F886)but version 2 code shows a mess on the LCD (16x2 and the 20x2). In order for me to get the PICAXE-28X2 (PIC18F25K22) to work I used the wizard on the picaxe program editor and convert version 1 and version 2 and change the nap command to sleep or doze (to the best of my knowledge) and version 1 code works but version 2 code shows the same mess on the lcd. Thanks Guys/Mate.... |
||||
Downwind Guru Joined: 09/09/2009 Location: AustraliaPosts: 2333 |
If thats the case there is a glitch somewhere in the LCD initialization, because of the black blocks on line one suggests the display has not been initialized. I must admit i find Glenns code hard to understand with the lack of variable names, it dose my head in trying to work through it, you might want to check your wiring to the LCD and ensure you have used all the pins EXACTLY as Glenn has in the exact order, to the exact locations on the LCD or it wont work. If i get a spare moment and feel like frying my brain for a moment i will compare both versions of code to see what the difference is. I think with 28x2 you need to set the pins as outputs using the "Let dirB = %xxxxxxxx" command in setup prior to Let pinsB = %xxxxxxxx, i know i had problems some time back with a 20x2 along these lines (just forget what it was now). The later picaxe M2 ans X2 range needs different setup commands used before some functions will work correctly even though the syntax checks out correctly. Pete. Sometimes it just works |
||||
scnarine Newbie Joined: 17/06/2011 Location: United StatesPosts: 29 |
Thanks for the quick reply Mr. Pete, here are a few pictures of my circuit: The first picture is with the version 1 code and the second is with the version two code that I convert using the conversion tool in the programming editor. http://www.thebackshed.com/forum/forum_posts.asp?TID=5655&KW =scnarine This chunk of data was added to gizmo's version 2 code after the conversion using the program editor wizard. ' 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 will check my circuit for incorrect wiring to the LCD as you suggested. I really appreciate all the help. |
||||
Page 1 of 3 |
Print this page |