Shop OBEX P1 Docs P2 Docs Learn Events
Interfacing ADC0834 to uoLED-96-PROP — Parallax Forums

Interfacing ADC0834 to uoLED-96-PROP

DiverBobDiverBob Posts: 1,108
edited 2008-03-22 00:42 in Propeller 1
I been experiencing some difficulty with interfacting the uoLED-96-PROP with a 4 input ADC0835 chip.
I·started using the CD_ADC0834 code from Object Exchange library. The demo code was sucessfully modified to run using "vga_text" to output the ADC values to a 15" LCD screen (looks good too). So I know the ADC works, the code is good·and the chip is wired correctly.
However when I try to do the same basic code of just displaying the ADC output in a repeating loop all I get is a non-changing value, depending on the way I try to print.
I use the following pin connections to the oled display:
P18 - sclk
P19 - Sars
P20 - Dout/in
P21 - CS

The display code looks basically like this:

adc.start(18)······· 'pin # for sclk
repeat
· temp1 := adc.GetADC(2)······ 'ADC input to measure
· oled.PutText(0,0,0, 255,255,0, xxxxxxxx)···· 'the xxxxxx is where I can not get the value for temp1 to print

I have used the Numbers library object (Num.ToStr(temp1, Num#DEC)) which I thought should work but it doesn't

I've tried numerous means of getting a value to show, right now I think I'm too close to the problem and am no longer seeing the obvious. I'm hoping someone else has tried a simular item using the uoLED and has the answer I'm missing

Thanks!

Bob

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-03-21 20:30
    The Numbers library object should have worked. What did you actually try and what happened?
  • DiverBobDiverBob Posts: 1,108
    edited 2008-03-21 20:59
    I got a continuous value of 255 on the output using the numbers object and num.tostr() method. That's what is frustrating right now, I have sucessfully used this function on the oLED for other programs, I just don't see why it isn't coming out right for this one - especially when it works under the VGA_Text object!

    Now I also modified the CD_ADC0834 library object to use the BS2 library object and the displayed output is 0 however I do notice what appears to be a number other than 0 flashing shortly after the program starts up. It almost seems to get a value and display it and then reverts back to 0 and stays there.

    Another thing that I was just thinking of was could the pin setup on the OLED be labeled wrong? I am going to do a quick test, just hook up some LEDs to the 4 pins and see if I can get them to light correctly. At least that should eliminate that as a problem.

    Bob
  • Mike GreenMike Green Posts: 23,101
    edited 2008-03-21 21:26
    The amount of information you're providing is not enough to be helpful. You really need to include your source programs as attachments.
  • DiverBobDiverBob Posts: 1,108
    edited 2008-03-21 22:03
    I was in the middle of trying to attach the files on my last post but my internet computer wasn't cooperating, it wouldn't read my USB stick, had to reboot. The wife wanted the computer so I just posted what I had and finally got the computer back.... smile.gif

    I attached the program file and the modified ADC0834 file also.
    I commented out a lot of the·main program file to simplify it, I have used both the modified and unmodified ADC0834 library files.

    Bob
  • Mike GreenMike Green Posts: 23,101
    edited 2008-03-21 22:35
    I can't see any obvious problem. I would go back a step and just use the uOLED driver and make sure it works as expected. I would then add the Numbers object and make sure I can display numbers as expected. I'd then add the ADC driver and try to display the output.

    I know this sounds like a waste of time, but you have multiple problems (display, ADC readings) and your program looks like it ought to work. You really have to simplify things to isolate where the problem is and that's the purpose of backtracking and partially starting over.
  • DiverBobDiverBob Posts: 1,108
    edited 2008-03-21 22:53
    I went back and re-ran earlier programs that use the Numbers and oLED objects, those all ran like they did before I started experimenting with the ADC chip. I am trying to measure 3 millivolt sources, I have been feeding the display program test data and was hoping to get the ADC going so I had 'real' values to work with...

    I think I am going to put this aside for a bit and go and start work on another part of the coding. I have a whole menu system to set up and test.

    I have been hovering on the outside of this forum for a while now, this is the first time I haven't been able to get something to work via experimentation or hints from postings in this forum. I really like programming the prop, so much more fun than the programming I get paid for..... And the oLED display is great fun. The project I am developing this for is·an underwater rebreather loop oxygen sensing and display. I have most of the displays worked out, including real-time moving plot that displays average O2 levels the diver is breathing. The miniature uoLED display resides in a small waterproof housing mounted 4-6 inches in front of the divers mask. A seperate box contains batteries and the ADC circuit along with a few other goodies and sends data serially to the display unit. Piezo-electric switches provide diver input.

    Thanks for your ideas so far!

    Bob
  • RaymanRayman Posts: 14,223
    edited 2008-03-21 23:02
    I think you have to do a "num.init" before using it...
  • Timothy D. SwieterTimothy D. Swieter Posts: 1,613
    edited 2008-03-22 00:42
    I was going to suggest that maybe you were not "blanking" the previous text/numbers before you printed the new text/numbers. I opened your source code and see that you are.

    I recommend what Mike was saying. Think strategically about your program and break it into small chuncks. It sounds like you are doing some of that already. You know the ADC object works. Breaking your program into chucks, and thinking through and testing each portion will help to verify any assumptions.

    Your application of the uOLED sounds very exciting. I love the little device!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Timothy D. Swieter

    www.brilldea.com·- check out the uOLED-IOC, an I/O expansion for the uOLED-96-PROP
    www.tdswieter.com
    One little spark of imagination is all it takes for an idea to explode
Sign In or Register to comment.