Shop OBEX P1 Docs P2 Docs Learn Events
Cog confusion — Parallax Forums

Cog confusion

T ChapT Chap Posts: 4,223
edited 2007-01-21 21:34 in Propeller 1
I was attempting to run DAC on the same cog as some other i2c stuff, but the DAC seemed to be causing everything to lockup and not work. So I set up the DAC on a new cog, but it will not change the DAC pin's state. Using the DACtest.pin program shown, the pins change with no problem.

It would be best to run the DAC on the same cog, but I am assuming it is conflicting with something, so if a new cog is the only option, can someone please see if there is an obvious error that would cause the pin to stay at 0.

Thanks

Post Edited (originator) : 1/21/2007 6:05:21 AM GMT

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-01-21 05:38
    There's an infinite repeat in the DAC_START method in PCF8575_demo:
    PUB DAC_START(PIN)
       DIRA := |< PIN
       FRQA := 0
       ctra := %00110 << 26 +  PIN
       repeat   
    
    
  • T ChapT Chap Posts: 4,223
    edited 2007-01-21 06:03
    I put that in thinking the new cog was stopping. Without the repeat there is no change, still no pin state change. I am thinking that the code does not correctly address which freqa is to be modified. The code does not have a way to specify which freqa on which cog is to me updated by the loop. That's all I can figure.
  • Mike GreenMike Green Posts: 23,101
    edited 2007-01-21 06:32
    Did you take out the COGNEW? If you want/need to run the DAC in another cog, you'll need to make a very different set of DAC routines so the proper registers in the proper cog are referenced.
  • T ChapT Chap Posts: 4,223
    edited 2007-01-21 06:35
    When I try it like you suggested with no new cog, no repeat the output is fine, but no i2c functions work. The LCD shows that the code got there, but none of the relays turn on in the test loop.

    I was thinking that for a new cog, the freqa could be updated with it's own loop updating off a global variable, where the global varioable gets updated via RS232.
  • Mike GreenMike Green Posts: 23,101
    edited 2007-01-21 06:47
    The I2C routines should work the same whether the DAC is in its own cog or the same one as the I2C routines.
    How about re-posting the current code that doesn't work?
  • T ChapT Chap Posts: 4,223
    edited 2007-01-21 06:52
    new version posted


    I moved the Start down a bit, the i2c wil run the relays until it hits the Dac Start, then no more i2c relay although the LCD indicated the loop is running. The DAC outputs do work though.
  • Mike GreenMike Green Posts: 23,101
    edited 2007-01-21 06:56
    Ah! Of course! You're changing the whole DIRA register:
       DIRA := |< PIN
    


    when what you should have is:
       DIRA |= |< PIN
    


    or:
       DIRA[noparse][[/noparse]PIN] := 1
    
  • T ChapT Chap Posts: 4,223
    edited 2007-01-21 07:07
    I was not aware that I changed it, I thought I just copied from the the old dactest, but thanks for the pointing that out! Let me check it now. To be honest, I have no idea what this does:

    DIRA := |< PIN
    




    Problem solved! Thanks Mike, you the man

    Post Edited (originator) : 1/21/2007 7:12:15 AM GMT
  • Mike GreenMike Green Posts: 23,101
    edited 2007-01-21 07:17
    When you use a counter to control an I/O pin, you have to set the pin as an output. When this is run in its own cog, it doesn't matter whether you clear the other bits or not. Obviously, when it's in the same cog as some other I/O, all the other pins get changed to inputs and the other routines don't work.
  • T ChapT Chap Posts: 4,223
    edited 2007-01-21 10:40
    I was trying to blow up the DAC pin but it wouldn't blow up. Here is the schematic of the circuit. The part is actually an opto FET but I don't have one in the library. The cicruit shunts the outputs of 16 relays. Prior to switching a relay, the shunt ramps down to GND via the single Prop DAC pin to eliminate the relay pop. I would have guessed that you could not run 16 leds off one pin, but it is going strong. The DAC goes to 16 opto fets that mute the audio on the other side.

    The meter on DC metered mA was extremely low, .06 mA at 3.3, 0mA at 0V. A 470 is shared between two led's, so there are 8 470's total over the 16 optos.

    I was testing options to beef up the Prop's output using several other transistor opto's, and said let's see what happens. If it lasted an hour already how good an indication is that to just leave it as is and forget the buffering to beef it up?

    The slowly ramped mute is very nice btw, also makes for a great volume control.

    www.nteinc.com/specs/3000to3099/pdf/nte3085.pdf

    Post Edited (originator) : 1/21/2007 10:45:04 AM GMT
    1001 x 614 - 92K
  • Mike GreenMike Green Posts: 23,101
    edited 2007-01-21 16:03
    The LEDs drop about 1.7V. With a 3.3V supply max, that leaves 1.6V. With the resistors you're using, you've got maybe 1.6ma per LED. That's only 25-26ma total and the Prop pins are supposed to be able to handle 50ma, so maybe you can find another 16 signals to mute. I don't think you'll blow up the pin with a load on the order of the pin rating since the output voltage will sag as the driver transistor heats up. If you want to blow up a pin, try a short circuit. The problem you get into is that the wiring, bonding, and on-chip interconnects will melt before the transistor heats up enough to limit the current. Do keep in mind that overdriving the pin a bit probably shortens the life of the pin ... maybe it will fail in a few years or months instead of lots of years.
  • T ChapT Chap Posts: 4,223
    edited 2007-01-21 21:34
    Thats great new Mike, glad I don't have to buffer it after all.
Sign In or Register to comment.