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 programing elmer
Author | Message | ||||
grandpam Newbie Joined: 07/06/2009 Location: CanadaPosts: 7 |
Hi I am new to the picaxe and am working my way through the tutorials. I would like an elmer to answer questions and give advise on a one to one basis. I find forums good but slow. Hope someone is willing to share their knowledge. Phil Moorey pmooreyca@gmail.com |
||||
GWatPE Senior Member Joined: 01/09/2006 Location: AustraliaPosts: 2127 |
What aspects of programming will you be needing a hand with. Gordon. become more energy aware |
||||
grandpam Newbie Joined: 07/06/2009 Location: CanadaPosts: 7 |
Hi Well currently i have managed to write a simple program using the simulator comparing two sensors as a differential thermostat. It works but when comparing it with other similar programs they seem to average out the readings and I don't know enough to understand why? Mine works on the simulator. Also find variable registars confusing. They are address points but the application of I am not sure. |
||||
SparWeb Senior Member Joined: 17/04/2008 Location: CanadaPosts: 196 |
Perhaps you could show us the code and tell us which Picaxe you are using? In the programming editor, you can select text, copy to clipboard, and paste into the the text box here in your next forum post. Will you datalog from a windmill? Are you interested in the PicLog kit? Steven T. Fahey |
||||
grandpam Newbie Joined: 07/06/2009 Location: CanadaPosts: 7 |
Hope this works. This is a program for a differential solar collector pump. The chip would be a 18x and will used lm225 sensors when they arrive. This is programmed so that the outside sensor exceed 150 degrees the pump shoots off, also when the inside sensor matches the outside sensor it also shuts off. main: readadc 1,b0 ; a1 outside sensor ; a2 inside sensor readadc 2,b1 b1 =b1+3 if b0 > b1 then top low 0 goto main top: if b0> 150 then bot high 0 goto main bot: low 0 goto main |
||||
GWatPE Senior Member Joined: 01/09/2006 Location: AustraliaPosts: 2127 |
The code above will work, but for more complicated programs, you may define the registers, to variable names like below, and also define constants to make the program more readable. you can change a value in one place, and all references will change as well. ********************************************** #picaxe18X Symbol outside_temp = b0 Symbol inside_temp = b1 Symbol offset = 3 Symbol Max_temp = 150 symbol pump_control = 0 main: readadc 1,outside_temp readadc 2,inside_temp inside_temp = inside_temp + offset if outside_temp > inside_temp then pump_on pump_off: low pump_control goto main pump_on: if inside_temp < max_temp then high pump_control else goto pump_off endif goto main end ****************************************** This is the tip of the proverbial iceberg with these micros. Gordon. become more energy aware |
||||
grandpam Newbie Joined: 07/06/2009 Location: CanadaPosts: 7 |
Yes I can see how defining will make things easier but I find it difficult to follow the flow of the program especially the references to low pump and high pump. Can you flesh out more detail there? Kind of difficult to admit not understanding, especially on an open forum but sure appreciate the assist. Phil |
||||
grandpam Newbie Joined: 07/06/2009 Location: CanadaPosts: 7 |
further note i am familiar with the "if then " instruction as it gives a flow to the instructions but seem lost without it Phil |
||||
GWatPE Senior Member Joined: 01/09/2006 Location: AustraliaPosts: 2127 |
I doubt that this Forum is the best platform to teach a programming language. You may need to find a good book on Basic programming, or enrol in the education system in a course related to this field. The program I posted above is pretty clear. On a micro application, there will always be the specific output pin control commands. Subroutines could have been used for the pump ON and pump OFF operations as well. The low and high commands are effectively functions that are called, with the pump_control value being which switch to activate. You will need to become familiar with the full programming function set and the syntax for each. The picaxe programming application has a very good help section. You have started with the picaxe18X. The picaxe08M would be a better option for this dedicated application. I am no expert, but have found that these micros are pretty forgiving, and can be reprogrammed hundreds, or thousands of times. The simulator helps as well in most cases. Try and place visual indicators on digital inputs and all outputs in your final pcb layout. It is possible to damage outputs if you accidently short 2 outputs together with a probe, in an effort to measure logic levels. I have LED indicators on the comm port as well. The picaxe are very versatile and for most applications with timing, logical sequencing, low resolution analogue mesurements and limited PWM output. I have used a single device for many diverse applications. I now have the picaxe14M and the picaxe 28X2 that I will be finding uses for. As long as the limits are not exceeded and the program is well debugged, then all is good. Some bugs are still able to get through the programmer that can cause a program to stop unexpectedly. This is probably why the devices are not to be used for life support systems. Gordon. become more energy aware |
||||
grandpam Newbie Joined: 07/06/2009 Location: CanadaPosts: 7 |
Yes I agree that this forum is not the place to go into detail however that was not my intention. I was seeking an elmer that would be willing to answer questions and offer tips like you have done and others do on other forums. I appreciate the suggestions that you have provided and will continue to learn how to master the power of the microchip. Thanks Grandpam |
||||
SparWeb Senior Member Joined: 17/04/2008 Location: CanadaPosts: 196 |
You could try using a flowchart. I find it helps sometimes, though I've been programming stuff for a while and usually skip that step. Back in school these were use a lot to illustrate program flow and structure. By the way, what's an "elmer"? I keep thinking of Elmer Fudd, but I wouldn't take advice from him! :^) Steven T. Fahey |
||||
grandpam Newbie Joined: 07/06/2009 Location: CanadaPosts: 7 |
Whats and elmer? In ham radio there are experienced hams that the new fellows can go to and ask questions and receive the benefit of their experience. Its a great system and even after all these years we still turn to those with experience and learn from them. grandpam |
||||
Downwind Guru Joined: 09/09/2009 Location: AustraliaPosts: 2333 |
Hi, Did you ever find youre "elmer"?? I understand how hard it can be to get a little help with electronics and programming to learning the basics. It is a pitty that some give up through a few simple problems and not understanding the solutions. Did you manage to get your project to work? Pete. Sometimes it just works |
||||
Bryan1 Guru Joined: 22/02/2006 Location: AustraliaPosts: 1344 |
I think what the op wants is a picaxe version of this ELMER 160. Which is a great learning curve into PIC microcontrollers to utilize their full power instead of an interpreter that the picaxe is which is one step up from the basic stamp. Sorry guys if you think I'm knocking the picaxe again but if you guys are happy with it so be it. The picaxe is great for getting into microcontrollers but the big problem exsists from the days of the basic stamp. When a person wants to move on from the picaxe or basic stamp they are back to square one as both of those interpreter platforms dont use encourage the user to consult the datasheet and learn about the pic's file structure and registers. A basic structured compiler like PBP ( pic basic pro) or Oshonsoft Basic IDE does use the pic's registers in the programs and is much more powerful for programming. Cheers Bryan |
||||
Print this page |