Discussion forum for the BasicX family of microcontroller chips.
|
Hi, I am trying to make a voltage sensor for the bx24 it has to be able to read up to 72 volts i am totally stumped so if anyone has any ideas please send them to me thanks kevin |
|
|
|
could you start off with a pre-scaler read that with a a/d converter. as you read it if the reading is not close to full scale (5v I guess) the set the prescaler down one knotch and read again. for instance start with a voltage divider of 15 to 1. full scale reading of 4.8v at 72 volts. if the reading is near 3.4v (50) then switch to pre-scaler of 10 to 1 and read again. 10-1 would give reading of 5v --- wrote: > -------------------------- eGroups Sponsor > > Hi, > > I am trying to make a voltage sensor for the bx24 > it has to be able to read up to 72 volts > i am totally stumped so if anyone has any ideas please send them to > me > thanks > > kevin __________________________________________________ /">http://mail.yahoo.com/ |
|
The easiest way is to use a voltage divider and a single supply opamp. The voltage divider consists of a 1 meg resistor and a 50K resistors in series. One end of the 50K goes to ground. The junction of the two resistors going to a the "+" opamp (via another 1 meg resistor). Bypass the "+" terminal with a 0.01 ceramic cap to ground. The "-" input of the OPAMP is connected to the output. For 100V in, the output of the divider should be about 4.76V. The OPAMP is there for isolation. You don't want to fry your BX24's ADCs with an inadvertent application of more than 5V. You can limit the output of the op amp with a zener diode. OPAMPS are cheap,BX24's aren't. --- In , kj62@y... wrote: > Hi, > > I am trying to make a voltage sensor for the bx24 > it has to be able to read up to 72 volts > i am totally stumped so if anyone has any ideas please send them to me > thanks > > kevin |
|
|
|
I have a similar circuit that could well do with some protection, Could you explain 'Bypass the + Terminal' - Maybe an ASCII diagram would be good. I take it that the 0.01 ceramic Cap is 0.01uf. Thanks. Ken --- In , "Schatzie Walton" <jdwalton@h...> wrote: > The easiest way is to use a voltage divider and a single supply opamp. > > The voltage divider consists of a 1 meg resistor and a 50K > resistors in series. One end of the 50K goes to ground. The junction > of the two resistors going to a the "+" opamp (via another 1 meg > resistor). Bypass the "+" terminal with a 0.01 ceramic cap to ground. > The "-" input of the OPAMP is connected to the output. For 100V in, > the output of the divider should be about 4.76V. > > The OPAMP is there for isolation. You don't want to fry your BX24's > ADCs with an inadvertent application of more than 5V. You can limit > the output of the op amp with a zener diode. OPAMPS are cheap,BX24's > aren't. > > --- In , kj62@y... wrote: > > Hi, > > > > I am trying to make a voltage sensor for the bx24 > > it has to be able to read up to 72 volts > > > > > > i am totally stumped so if anyone has any ideas please send them to > me > > thanks > > > > kevin |
|
|
|
Good evening, Is there a way to store ADC values directly to a 0 to 255 range? Here 255 would be 5V of course. I would like to avoid dealing with large integer values for one program. A byte would be quite nice instead. Thank you for your time, Paul |
|
|
|
Divide the output of GetADC() by 4? Ex. byte bVal bVal = CByte( GetADC(13) \ 4 ) This would actually get you a maximum of 256. You could simply subtract 1 from GetADC to get a max of 255 (I think the division will always truncate). If that doesn't work, convert the getADC output to a single and divide by 4.0157. Use CByte to convert the result to a byte. On Wed, 20 Sep 2000 19:34:11 -0700 (PDT), you wrote: > >Good evening, > > Is there a way to store ADC values directly to a 0 to 255 range? >Here 255 would be 5V of course. > > I would like to avoid dealing with large integer values for one >program. A byte would be quite nice instead. > > Thank you for your time, >Paul ************************************** Do not taunt Happy Fun Ball. |
|
|
|
Hello Mikey, Thanks, this is what one would clearly do. I had thought there was a newer ADC function which stores directly to a byte. That would be more desireable, as I wouldn't have to take precious program time to convert. Perhaps I was thinking of ADC to Com which is relatively new... Thank you for your help, Paul On Thu, 21 Sep 2000 wrote: > Divide the output of GetADC() by 4? Ex. > > byte bVal > > bVal = CByte( GetADC(13) \ 4 ) > > This would actually get you a maximum of 256. You could simply > subtract 1 from GetADC to get a max of 255 (I think the division will > always truncate). > > If that doesn't work, convert the getADC output to a single and divide > by 4.0157. Use CByte to convert the result to a byte. > > On Wed, 20 Sep 2000 19:34:11 -0700 (PDT), you wrote: > > > >Good evening, > > > > Is there a way to store ADC values directly to a 0 to 255 range? > >Here 255 would be 5V of course. > > > > I would like to avoid dealing with large integer values for one > >program. A byte would be quite nice instead. > > > > Thank you for your time, > >Paul > > > > > > > > > > > > ************************************** > Do not taunt Happy Fun Ball. |
|
|
|
I don't think I'd worry too much about the time needed to do the arithmetic compared to the time needed to do the ADC, although I'm unsure of how long the divide by 4 operation would take. If this is a concern, you could just shift the ADC result right two places to effectively get a divide by 4 (assuming you can shift integer values right on the bx-24 -- I haven't actually checked). This should be pretty speedy. On Thu, 21 Sep 2000 22:41:23 -0700 (PDT), you wrote: >Hello Mikey, > > Thanks, this is what one would clearly do. I had thought there was a >newer ADC function which stores directly to a byte. That would be more >desireable, as I wouldn't have to take precious program time to convert. > Perhaps I was thinking of ADC to Com which is relatively new... > > Thank you for your help, >Paul >On Thu, 21 Sep 2000 wrote: > >> >> Divide the output of GetADC() by 4? Ex. >> >> byte bVal >> >> bVal = CByte( GetADC(13) \ 4 ) >> >> This would actually get you a maximum of 256. You could simply >> subtract 1 from GetADC to get a max of 255 (I think the division will >> always truncate). >> >> If that doesn't work, convert the getADC output to a single and divide >> by 4.0157. Use CByte to convert the result to a byte. >> >> >> >> On Wed, 20 Sep 2000 19:34:11 -0700 (PDT), you wrote: >> > >> >Good evening, >> > >> > Is there a way to store ADC values directly to a 0 to 255 range? >> >Here 255 would be 5V of course. >> > >> > I would like to avoid dealing with large integer values for one >> >program. A byte would be quite nice instead. >> > >> > Thank you for your time, >> >Paul >> > >> > >> > >> > >> > >> >> ************************************** >> Do not taunt Happy Fun Ball. >> >> > ************************************** Do not taunt Happy Fun Ball. |