Discussion forum for the BasicX family of microcontroller chips.
|
Greetings all - I am just getting started with the BX-24 and was hoping for some advice and guidance. My application is data acquisition and control. I need to determine the position of some switches and potentiometers and control the position of some analog gauges and the on/off status of some indicator lamps. I'm fairly sure I can use the digital I/O lines to read switch positions or drive LEDs, and even read/drive analog with the analog ports, but is it possible to send commands from a pre-exisitng set of instructions generated by an application running on a PC? That is, how could I send the BX-24 a command over the serial port and have it turn on a lamp or drive a meter to a certain position? Any advice greatly appreciated. -df |
|
|
|
I just went through something similar so check this link for how i got the serial
port up and going. This shows communication from the bx to the pc. This should get you
looking in the right direction. For turning on a lamp you will have to poll for data on
the serial port get your info and then use putpin to set what ever pin high (turn power
on) http://groups.yahoo.com/group/basicx/message/13631 ----- Original Message ----- From: Dexter Francis To: Sent: Tuesday, May 20, 2003 10:52 AM Subject: [BasicX] Getting started Greetings all - I am just getting started with the BX-24 and was hoping for some advice and guidance. My application is data acquisition and control. I need to determine the position of some switches and potentiometers and control the position of some analog gauges and the on/off status of some indicator lamps. I'm fairly sure I can use the digital I/O lines to read switch positions or drive LEDs, and even read/drive analog with the analog ports, but is it possible to send commands from a pre-exisitng set of instructions generated by an application running on a PC? That is, how could I send the BX-24 a command over the serial port and have it turn on a lamp or drive a meter to a certain position? Any advice greatly appreciated. -df Yahoo! Groups Sponsor Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. [Non-text portions of this message have been removed] |
|
Hello all, Here is a newbie question what is the best way to get started? When one has very little programming knowledge. I have been an electronics technician for years(fixing equipment) I am just not a design engineer. I have a couple of ideas for projects, but I don't really know where to start. Any suggestions would be great Thanks Patrick |
|
|
|
--- In , "nuepatrick" <nuepatrick@y...> wrote: > When one has very little programming knowledge. I have been an > electronics technician for years(fixing equipment) I am just not a > design engineer. I have a couple of ideas for projects, but I don't > really know where to start. Ah, yes! Where to start? A lot depends on your preferred style of learning. Some folks do best in a "learn by doing" mode. Others like to get the fundamentals down by reading some and then moving on to applying them. Personally, I use a combination of the two: read a little, do a little, read a little... I think that you have an advantage over those who don't have much, if any, electronics background. I think that it is easier to learn the programming part than it is to learn the electronics part. Do you already have a prototyping board? If not, you might want to get one from Jameco or elsewhere like this one: http://tinyurl.com/3lplc. A larger one might be better depending on what you think you might do in the future. I have several so I don't have to tear down a project to start another one. Another option is to get the BX24 Development Board from basicx.com. Although this is specialized for the BX-24, it does have the advantage that it already has the serial connector, power jack and a few switches on it. Prof. Anderson has a small kit that contains a BX-24, some resistors, caps, LEDs and a bit of hookup wire. This is a convenient package to start with. You can find information on that at: http://www.phanderson.com/basicx/index.html Other pages at his site have a lot of sample routines from which you may be able to learn some basic concepts. Prof. Anderson also has an eBay store at which you can buy the BX-24 for a good price. His seller id is pha555. see: http://tinyurl.com/5yr6b |
|
|
|
Don, I do have the bx24 dev board I guess the question is do I start with hardware or software. Logically it I think it should be the hardware. I have ideas just not sure of the best way to get started, and the even bigger challange is writing programs. Are there some templates on how to write code correctly? What is the best way to write code, what is to proper structure. I have read looked at a couple of different books Any suggestions. P.S. I am one who is hands on. Thanks again for the advice and help Patrick --- In , "Don Kinzer" <dkinzer@e...> wrote: > > --- In , "nuepatrick" <nuepatrick@y...> wrote: > > When one has very little programming knowledge. I have been an > > electronics technician for years(fixing equipment) I am just not a > > design engineer. I have a couple of ideas for projects, but I don't > > really know where to start. > > Ah, yes! Where to start? A lot depends on your preferred style of > learning. Some folks do best in a "learn by doing" mode. Others > like to get the fundamentals down by reading some and then moving on > to applying them. Personally, I use a combination of the two: read a > little, do a little, read a little... > > I think that you have an advantage over those who don't have much, if > any, electronics background. I think that it is easier to learn the > programming part than it is to learn the electronics part. > > Do you already have a prototyping board? If not, you might want to > get one from Jameco or elsewhere like this one: > http://tinyurl.com/3lplc. A larger one might be better depending on > what you think you might do in the future. I have several so I don't > have to tear down a project to start another one. > > Another option is to get the BX24 Development Board from basicx.com. > Although this is specialized for the BX-24, it does have the > advantage that it already has the serial connector, power jack and a > few switches on it. > > Prof. Anderson has a small kit that contains a BX-24, some resistors, > caps, LEDs and a bit of hookup wire. This is a convenient package to > start with. You can find information on that at: > http://www.phanderson.com/basicx/index.html > Other pages at his site have a lot of sample routines from which you > may be able to learn some basic concepts. Prof. Anderson also has an > eBay store at which you can buy the BX-24 for a good price. His > seller id is pha555. > see: http://tinyurl.com/5yr6b |
|
|
|
--- In , "nuepatrick" <nuepatrick@y...> wrote: > Are there some templates on how to write code correctly? > What is the best way to write code, what is to proper structure. There are a number of attributes related to well structured code. Two of them are the concepts of coupling and cohesion. Here is a link to a page describing those concepts: http://c2.com/cgi/wiki?CouplingAndCohesion See also this link describing structured programming: http://en.wikipedia.org/wiki/Structured_programming The basic idea is to have a procedure implement a well-defined and easy to grasp concept. If you can't describe what a procedure does in a few sentences, it's probably doing too much. These ideas are good to keep in mind. However, if your application is very complex, you may find that you have to start compromising in order to get it to fit within the constraints of the BX-24, especially with regard to the limited RAM available. Those compromises should, of course, be delayed until absolutely necessary. |
|
|
|
Don, Thanks for the info I will check it out. Another quick comparison question. which is better the basicx or the basicatom24? Thanks Patrick --- In , "Don Kinzer" <dkinzer@e...> wrote: > > --- In , "nuepatrick" <nuepatrick@y...> wrote: > > Are there some templates on how to write code correctly? > > What is the best way to write code, what is to proper structure. > > There are a number of attributes related to well structured code. > Two of them are the concepts of coupling and cohesion. Here is a > link to a page describing those concepts: > http://c2.com/cgi/wiki?CouplingAndCohesion > > See also this link describing structured programming: > http://en.wikipedia.org/wiki/Structured_programming > > The basic idea is to have a procedure implement a well-defined and > easy to grasp concept. If you can't describe what a procedure does > in a few sentences, it's probably doing too much. > > These ideas are good to keep in mind. However, if your application > is very complex, you may find that you have to start compromising in > order to get it to fit within the constraints of the BX-24, > especially with regard to the limited RAM available. Those > compromises should, of course, be delayed until absolutely necessary. |
|
|
|
--- In , "nuepatrick" <nuepatrick@y...> wrote: > which is better the basicx or the basicatom24? I haven't used the BasicAtom but a cursory examination of the datasheet and programming manual for the standard and pro version suggests that it is not much more than an enhanced BasicStamp. The language is the same (antiquated) Basic dialect of the Stamp. No parameterized procedures - data can only be passed to subroutines in global memory. The Pro version looks to be faster than and has more RAM than the BX- 24. I don't think that that difference offsets the disadvantage of the primitive language. It is interesting that the Atom does not appear to have a pre- programmed interpreter (virtual machine). Rather, your code is compiled (either to p-code or native machine code) and downloaded along with library routines and other support code. |
|
|
|
Don, Here is what I need to do to start I need to setup up 3 seperate timers that are controlled by actions performed by a door being opened, and also a pre trigger timer and a trigger timer both controlled by a motion detector. I would like to be able to change the time by changing a single varaiable for each timer. any ideas. This is where I have problems in setting up the code to perform the actions I need. Thanks Patrick --- In , "Don Kinzer" <dkinzer@e...> wrote: > > --- In , "nuepatrick" <nuepatrick@y...> wrote: > > which is better the basicx or the basicatom24? > > I haven't used the BasicAtom but a cursory examination of the > datasheet and programming manual for the standard and pro version > suggests that it is not much more than an enhanced BasicStamp. The > language is the same (antiquated) Basic dialect of the Stamp. No > parameterized procedures - data can only be passed to subroutines in > global memory. > > The Pro version looks to be faster than and has more RAM than the BX- > 24. I don't think that that difference offsets the disadvantage of > the primitive language. > > It is interesting that the Atom does not appear to have a pre- > programmed interpreter (virtual machine). Rather, your code is > compiled (either to p-code or native machine code) and downloaded > along with library routines and other support code. |
|
|
|
--- In , "nuepatrick" <nuepatrick@y...> wrote: > I need to setup up 3 seperate timers that are controlled by actions > performed by a door being opened, and also a pre trigger timer and > a trigger timer both controlled by a motion detector. I would like > to be able to change the time by changing a single varaiable for > each timer. Much depends on the duration that you want to time and the nature and timing of the signals to which the code must respond. If the signals are asserted until they are cleared (essentially, latched until they are serviced) or if they have an "on" time that is relatively long, I don't see a problem. The BX-24 could be programmed to poll each of the inputs and respond accordingly. The independent timers are not a problem if the allowable resolution is fairly coarse. You can use the Timer() function to get the current time-of-day when an event occurs. In your polling loop, you can check each of the running timers against their own limit and then take action when the limit is reached. The problem that you have to watch for is if the BX-24 has to do too much work responding to inputs or timer threshold events that it can't respond timely to additional events. Some of this problem may be mitigated by using the BX-24's multi-tasking capability. Is this for a personal project or a commercial one? |
|
|
|
--- In , "Don Kinzer" <dkinzer@e...> wrote: > > --- In , "nuepatrick" <nuepatrick@y...> wrote: > > I need to setup up 3 seperate timers that are controlled by actions > > performed by a door being opened, and also a pre trigger timer and > > a trigger timer both controlled by a motion detector. I would like > > to be able to change the time by changing a single varaiable for > > each timer. > > Much depends on the duration that you want to time and the nature and > timing of the signals to which the code must respond. If the signals > are asserted until they are cleared (essentially, latched until they > are serviced) or if they have an "on" time that is relatively long, I > don't see a problem. The BX-24 could be programmed to poll each of > the inputs and respond accordingly. > > The independent timers are not a problem if the allowable resolution > is fairly coarse. You can use the Timer() function to get the > current time-of-day when an event occurs. In your polling loop, you > can check each of the running timers against their own limit and then > take action when the limit is reached. The problem that you have to > watch for is if the BX-24 has to do too much work responding to > inputs or timer threshold events that it can't respond timely to > additional events. Some of this problem may be mitigated by using > the BX-24's multi-tasking capability. > > Is this for a personal project or a commercial one? The three timers I need ar as follows 1 minute 50 seconds, 3 minutes, and 20 minutes. What I would really like to do is by changing 1 var change the time. any help would be greatly appericated. Also how do the interrupts work on this thing? I have a couple of events that I would like to trigger, when say a door is opened or motion is sensed. How do I do this? Thanks for the help Patrick |
|
|
|
dim T1 as single dim T2 as single dim T3 as single T1 = 0.0 T2 = 0.0 T3 = 0.0 do if (timer >t1) then t1 = timer +110.0 '110sec = 1min 50 debug.print "1min 50" do action 1 here end if if (timer > T2) then T2 = timer + 180.0 '3 min debug.print "3 min" do action 2 here end if if (timer > T3) then T3 = timer+1200.0 '20 min debug.print "20 min" do action 3 here end if debug.print " The time is " & chrs(timer) 'timer to screen loop You will need to take care of the rollover at the end of the day when timer gets to 84600.0 and rolls over to 0.0 . You can test what happens here by putting call putTime( 23,59,0.0) in front of the do instruction. This will cause the timer to rollover in 1 minute. I'll let you work out how to do this. nuepatrick wrote: > --- In , "Don Kinzer" <dkinzer@e...> wrote: > > > > --- In , "nuepatrick" <nuepatrick@y...> wrote: > > > I need to setup up 3 seperate timers that are controlled by actions > > > performed by a door being opened, and also a pre trigger timer and > > > a trigger timer both controlled by a motion detector. I would like > > > to be able to change the time by changing a single varaiable for > > > each timer. > > > > Much depends on the duration that you want to time and the nature and > > timing of the signals to which the code must respond. If the signals > > are asserted until they are cleared (essentially, latched until they > > are serviced) or if they have an "on" time that is relatively long, I > > don't see a problem. The BX-24 could be programmed to poll each of > > the inputs and respond accordingly. > > > > The independent timers are not a problem if the allowable resolution > > is fairly coarse. You can use the Timer() function to get the > > current time-of-day when an event occurs. In your polling loop, you > > can check each of the running timers against their own limit and then > > take action when the limit is reached. The problem that you have to > > watch for is if the BX-24 has to do too much work responding to > > inputs or timer threshold events that it can't respond timely to > > additional events. Some of this problem may be mitigated by using > > the BX-24's multi-tasking capability. > > > > Is this for a personal project or a commercial one? > > The three timers I need ar as follows 1 minute 50 seconds, 3 minutes, > and 20 minutes. What I would really like to do is by changing 1 var > change the time. any help would be greatly appericated. Also how do > the interrupts work on this thing? I have a couple of events that I > would like to trigger, when say a door is opened or motion is sensed. > How do I do this? > > Thanks for the help > Patrick > > > *Yahoo! Groups Sponsor* > <http://us.ard.yahoo.com/SIG=129aahmk4/M=281955.5530326.6602771.3001176/D=groups/S=1706554205:HM/EXP=1099102554/A=2343726/R=0/SIG=12imeb24v/*http://clk.atdmt.com/VON/go/yhxxxvon01900091von/direct/01/&time=1099016154188742 > Get unlimited calls to > > U.S./Canada > > <http://us.ard.yahoo.com/SIG=129aahmk4/M=281955.5530326.6602771.3001176/D=groups/S=1706554205:HM/EXP=1099102554/A=2343726/R=1/SIG=12imeb24v/*http://clk.atdmt.com/VON/go/yhxxxvon01900091von/direct/01/&time=1099016154188742 > > ------------------------------------------------------------------------ > *>. |
|
--- In , "nuepatrick" <nuepatrick@y...> wrote: > [...] how do the interrupts work on this thing? You can prepare a task that will respond to an interrupt (there is only one external interrupt input available). Read about the system library function WaitForInterrupt(). Note, however, that it is possible to have several external events trigger the external interrupt as long as there are inputs that you can read to determine which of them actually requested service. |