This Forum is Dedicated For all The Object Oriented PIC Lovers .......... The concept behind OOPic is straight forward. Use preprogrammed multitasking Objects from a library of highly optimized Objects to do all the work of interacting with the hardware. Then write small scripts in Basic, C, or Java syntax styles to control the Objects. During operation, the Objects run continuously and simultaneously in the background while the scripts run in the foreground telling the objects what to do.

Friday, October 5, 2007

[oopic] Re: Cadmium CDS (oCdS)

I got it working! Thanks mate. Still don't know what the problem was.

Anyway.. I get a nice positive range from 0 to 120 when i shine light
on it. The problems begin when I go into the negative range. As you
can see from my program, I'm saving the value of light intensity in B,
which is defined as an OByte object. It has a range of 0-255.

I don't remember much about negative binary numbers, but I'm quite
sure that any value over 128 is negative.

I changed the program to print a minus sign whenever I.Level is less
than 0, but I get things like -200 or -250.

My problem: How to take the magnitude of an oByte number?


--- In oopic@yahoogroups.com, "dan michaels" <oric_dan@...> wrote:
>
> --- In oopic@yahoogroups.com, "teh_gamr" <ashraf.hammoud@> wrote:
> >
>
>
> With a CdS cell, all you need do it connect it up in a voltage
> divider to 5v, using a 10K or so resistor for a pullup, and then
> connect the v.div output to any A/D converter channel on the oopic.
>
> If you're using one of the oopic sample programs, you first need to
> double check the sensor is connected to the same I/O line as the
> program uses. Not connected to the correct pin is the most common
> mistake people make.
>
> - dan michaels
> www.oricomtech.com
> -- OOBOT40 Boards ---
> ========================
>
>
> > Hello,
> >
> > I'm trying to use a CdS cell with my oopic. I'm certain that I've
> > done the wiring correctly, it's quite simple.
> >
> > http://oopic.com/ocds.htm

has the following sample program:
> >
> > "I As oCdS(1,0,cvOn)
> > P As oDIO8(3,cvOutput)
> >
> > 1:
> > P.State = I.Level
> > Goto 1"
> >
> > Using this as a reference, I tried outputing the i.level value to
> an
> > LCD:
> >
> >
> >
> > "LCD As oLCD(3,1,27,26,cvOn)
> > b As oByte
> > I As oCdS(1,0,cvOn)
> > I.IOLine = 14
> > LCD.Init
> > LCD.Clear
> > LCD.Locate(0,0) ' Locate cursor at 2nd row, 3rd column.
> >
> >
> > Do
> > LCD.Locate(0,0)
> > b = 0
> > b = I.Level
> > LCD.VString = Str$(b)
> > Delay = 500
> > Loop
> > "
> >
> >
> > I get "00154" or "00153" on the LCD. The value varies +-1.
> >
> > Shining or turning off the light makes no difference. I tried using
> > another cell, same results.
> >
> > Some clue as to what could be wrong: removing the cell or
> > disconnecting it from the i/o line makes no difference.
> > Im certain the wiring is right.. Could it be the program?
> >
> >
> >
> > Thanks in advance
> >
>



Yahoo! Groups Links

<*> To visit your group on the web, go to:

http://groups.yahoo.com/group/oopic/

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:

http://groups.yahoo.com/group/oopic/join

(Yahoo! ID required)

<*> To change settings via email:
mailto:oopic-digest@yahoogroups.com
mailto:oopic-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
oopic-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:

http://docs.yahoo.com/info/terms/

No comments: