Parallax Forums
  HomeLog InRegisterCommunity CalendarSearch the ForumHelp
   
Parallax Forums > Public Forums > Propeller Chip > Program help, not making sence.....  Forum Quick Jump
 
New Topic Post Reply Printable Version
[ << Previous Thread | Next Thread >> ] | Show Newest Post First ]

jknightandkarr
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Apr 2009
Total Posts : 57
 
   Posted 11/6/2009 9:58 PM (GMT -8)    Quote This PostAlert An Admin About This Post.
I have the PropRPM & I'm having issues trying to create my first program using all 10 leds, to light em up 1 at a time. one per sec. Here's the problem. Instead of doing what I want, it's doing the exact opposite, starts with all on & turns em off 1 per sec, that orone of 2 other things, no leds come on or P17, 18, 19, 23, 24 & 25 light on at once & P16, 20, 21, 22 stay off. Pendinging how I try & figure out what I've done wrong. I also did a very similar program on my BS2 & it worked just fine, so I know the leds are fine. There's an error someplace, According to what I know on the BS2 it should work.

My problem prone program.
'Countup LEDs
Con
_clkmode = xtal1+pll8x
_xinfreq = 5_000_000
PUB Ledallon
  dira[16]:=1
  dira[17]:=1
  dira[18]:=1
  dira[19]:=1
  dira[20]:=1
  dira[21]:=1
  dira[22]:=1
  dira[23]:=1
  dira[24]:=1
  dira[25]:=1
  outa[16]:=1
  repeat 25
    waitcnt(80_000_000+cnt)
    outa[17]:=1
    waitcnt(80_000_000+cnt)
    outa[18]:=1
    waitcnt(80_000_000+cnt)
    outa[19]:=1
    waitcnt(80_000_000+cnt)
    outa[20]:=1
    waitcnt(80_000_000+cnt)
    outa[21]:=1
    waitcnt(80_000_000+cnt)
    outa[22]:=1
    waitcnt(80_000_000+cnt)
    outa[23]:=1
    waitcnt(80_000_000+cnt)
    outa[24]:=1
    waitcnt(80_000_000+cnt)
    outa[25]:=1
    waitcnt(80_000_000+cnt)


I know the chip & LEDs are fine. This other program works flawlessly.

'Alternating LEDs
Con
_clkmode = xtal1+pll16x
_xinfreq = 5_000_000
PUB Ledallon
  dira[16]:=%1
  outa[16]:=%1
  dira[17]:=%1
  outa[17]:=%0
  dira[18]:=%1
  outa[18]:=%1
  dira[19]:=%1
  outa[19]:=%0
  dira[20]:=%1
  outa[20]:=%1
  dira[21]:=%1
  outa[21]:=%0
  dira[22]:=%1
  outa[22]:=%1
  dira[23]:=%1
  outa[23]:=%0
  dira[24]:=%1
  outa[24]:=%1
  dira[25]:=%1
  outa[25]:=%0
  REPEAT 25
    !outa[16]
    !outa[17]
    !outa[18]
    !outa[19]
    !outa[20]
    !outa[21]
    !outa[22]
    !outa[23]
    !outa[24]
    !outa[25]
    waitcnt(clkfreq+cnt)


This don't make sence. Anytime I try & get all LED's to light up at once, they all stay off. I thought it was my 9V, 900 mA power supply, figured it wasn't enough mA to do it, so I put it on my old 486 pc Power supply, & taking my 10.1 VDC out of the power supply made a quick voltage divider out of 2 resistors & took the voltage to 9.17 VDC & same thing, so my problem isn't mA. According to what I've read soo far & from what I know on the BS2 Homeworkboard kit, my program should have worked correctly & done what I wanted it to do. What am I missing here??

Joe


I'm going insaine. It's SOOOOOO much fun. lol

Post Edited (jknightandkarr) : 11/7/2009 6:41:27 AM GMT

Back to Top
 

ElectricAye
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Jul 2008
Total Posts : 972
 
   Posted 11/6/2009 10:07 PM (GMT -8)    Quote This PostAlert An Admin About This Post.
First, try using the CODE formatting buttons to enclose your code so it shows up on this screen the way it would on your computer.

Second, are you sure you are indenting your code properly under your REPEAT command? It's hard to tell when your code is not using the CODE formatting mentioned above.
Back to Top
 

Mike Green
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Oct 2004
Total Posts : 13554
 
   Posted 11/6/2009 10:15 PM (GMT -8)    Quote This PostAlert An Admin About This Post.
Maybe you have the LEDs hooked up wrong. Your program starts off with the I/O pins by default set to low (0V) and you set them one by one to high (3.3V) and leave them there (assuming the indenting is correct ... I can't tell). You need something like:

I/O pin ---\/\/\/\/\/---LED anode

LED cathode --- ground

The resistor can be anything from about 1K to 100 Ohms
Back to Top
 

jknightandkarr
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Apr 2009
Total Posts : 57
 
   Posted 11/6/2009 10:36 PM (GMT -8)    Quote This PostAlert An Admin About This Post.
Sorry, I didn't know about the CODE button, but ok I edited the code & on I had everything after repeat 10 indented & all it does is flash on for a split second & then goes out.

Con
  _clkmode = xtal1+pll16x
  _xinfreq = 5_000_000
PUB Ledallon
  dira[16..25]:=%1111111111
  outa[16..25]:=%0000000000
  repeat 10
    OUTA[16]:=1
    waitcnt(80_000_000+cnt)
    OUTA[17]:=1
    waitcnt(80_000_000+cnt)
    OUTA[18]:=1
    waitcnt(80_000_000+cnt)
    OUTA[19]:=1
    waitcnt(80_000_000+cnt)
    OUTA[20]:=1
    waitcnt(80_000_000+cnt)
    OUTA[21]:=1
    waitcnt(80_000_000+cnt)
    OUTA[22]:=1
    waitcnt(80_000_000+cnt)
    OUTA[23]:=1
    waitcnt(80_000_000+cnt)
    OUTA[24]:=1
    waitcnt(80_000_000+cnt)
    OUTA[25]:=1
    waitcnt(80_000_000+cnt)


Mike,
On the PropRPM my bargraph leds are built into the circuit board straight from parallax on Pins 16-25, while removable, I cannot change the pin wiring or anything like that I can only remove the bargraph leds & replace them. They are working, so I know there in the socket correctly. My Alternating LEDs program works perfictly as I wanted it too, it the one I posted above that's the problem. I want it to start with P16 & light each led up in sequance to P25 being the 10th led with about 1 second between them, I tested it on my BS2 I have & my program worked flawlessly, so I don't get why it's not working here.

Joe


I'm going insaine. It's SOOOOOO much fun. lol

Back to Top
 

Nick Mueller
Registered Member

Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Apr 2007
Total Posts : 694
 
   Posted 11/6/2009 10:53 PM (GMT -8)    Quote This PostAlert An Admin About This Post.
In your repeat loop, you are repeatedly switching on the LEDs, but never off.

Nick


Never use force, just go for a bigger hammer!

The DIY Digital-Readout for mills, lathes etc.:
YADRO

Back to Top
 

jknightandkarr
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Apr 2009
Total Posts : 57
 
   Posted 11/6/2009 10:55 PM (GMT -8)    Quote This PostAlert An Admin About This Post.
I just got my problem program working as I wanted it too. After looking over the scematics for the PropRPM board, the 10 built in leds are wired as follows.

3.3VDC to 10-180 Ohm Resistors, then to each led, & then to P16 to P25 of the Propeller Chip. All I had to do is change....
outa[16..25]:=%0000000000 to outa[16..25]:=%1111111111

& change the...

OUTA[pin]:=1 to OUTA[pin]:=0

to ground the leds & complete the circuit. I'll have to remember that & when I build a permant circuit with a Propeller to change them back to the way they was before. :p Thanks Guys!!!

Joe

Ok New problem. I get to P24, it lights up but VERY VERY breefly. Then restarts over odd, P25 don't even light up. I figured adding more pause time would help, but it didn't do anything to change it.


I'm going insaine. It's SOOOOOO much fun. lol

Post Edited (jknightandkarr) : 11/7/2009 7:08:38 AM GMT

Back to Top
 

Mike Green
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Oct 2004
Total Posts : 13554
 
   Posted 11/6/2009 11:14 PM (GMT -8)    Quote This PostAlert An Admin About This Post.
You probably don't really have the indenting the way you've shown it here. When the Ledalion routine exits, the cog is reset and all of the outputs are turned off. Put a long pause after the last OUTA. You'll see that P24 and P25 stay on longer.
Back to Top
 

jknightandkarr
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Apr 2009
Total Posts : 57
 
   Posted 11/6/2009 11:35 PM (GMT -8)    Quote This PostAlert An Admin About This Post.
I tried that, increased the 80_000_000 to 320_000_000, so should be 4 seconds? Same effect Also copied waitcnt(80_000_000+cnt) & made it

waitcnt(80_000_000+cnt)
waitcnt(80_000_000+cnt)
waitcnt(80_000_000+cnt)
waitcnt(80_000_000+cnt)

Either way it didn't seam to help. I've looked into alternative ways of pausing & all had the same effect.

Joe


I'm going insaine. It's SOOOOOO much fun. lol

Back to Top
 

Mike Green
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Oct 2004
Total Posts : 13554
 
   Posted 11/7/2009 7:35 AM (GMT -8)    Quote This PostAlert An Admin About This Post.
Without a real copy of your program, we're just guessing. Use the Attachment Manager by clicking on the Post Reply button to attach a copy of your program source file to a reply.
Back to Top
 

jknightandkarr
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Apr 2009
Total Posts : 57
 
   Posted 11/7/2009 9:34 AM (GMT -8)    Quote This PostAlert An Admin About This Post.
here it is.

Joe


I'm going insaine. It's SOOOOOO much fun. lol



File Attachment :
countingled.spin   1KB (application/octet-stream)
This file has been downloaded 9 time(s).
Back to Top
 

Mike Green
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Oct 2004
Total Posts : 13554
 
   Posted 11/7/2009 10:31 AM (GMT -8)    Quote This PostAlert An Admin About This Post.
Your program should function as written. It initializes I/O pins 16-25 to low outputs, then sets them one by one (16 to 25) to high at one second intervals and repeats that 10 times (with no further visible effect). After 100 seconds, the whole program stops with all the I/O pins set to inputs.

The visual effect should be that all the LEDs initially turn on, then #16 turns off after a few microseconds, then one by one the others (#17 to #25) turn off at one second intervals.
Back to Top
 

Todd Chapman
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined May 2006
Total Posts : 1538
 
   Posted 11/7/2009 10:42 AM (GMT -8)    Quote This PostAlert An Admin About This Post.
What is the point of repeating the loop 10 times if you never change the LED's back to OFF state?

The cog will die after 10 repeats as is. If you put the repeat at the end the cog will remain alive and the state of the LEDs will be the same as the code you have written.
Back to Top
 

jknightandkarr
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Apr 2009
Total Posts : 57
 
   Posted 11/7/2009 8:31 PM (GMT -8)    Quote This PostAlert An Admin About This Post.
Todd Chapman, was just trying to look at ways of keeping the leds on & trying to figure out my problem.

Question. If I go over on mA, will the propeller reset itself? I ask this because after putting ' infront of outa[24] & outa[25] lines that turned them into the same as comments, the leds quit restarting & stayed lit. that is after I moved the repeat command down to the bottom to make it just repeat nothing. I think I'm just over on the mA is why my display is screwing up.

Joe


I'm going insaine. It's SOOOOOO much fun. lol

Back to Top
 

Todd Chapman
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined May 2006
Total Posts : 1538
 
   Posted 11/7/2009 9:09 PM (GMT -8)    Quote This PostAlert An Admin About This Post.
There is a limit, look at the manual for more info on it, I don't remember exactly. It is a good test to turn on each LED separately though which will identify if the current is what is causing it, sounds like it is.
Back to Top
 

Mike Green
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Oct 2004
Total Posts : 13554
 
   Posted 11/7/2009 9:36 PM (GMT -8)    Quote This PostAlert An Admin About This Post.
Assuming you have red LEDs, they have a forward voltage of 1.7V. They're running off the 3.3V supply, so you have to drop 3.3V - 1.7V = 1.6V across the 180 Ohm resistors. By Ohm's Law, that sets the LED current to 9mA. If you have 10 of them, that's 90mA. A Prop should be able to handle that easily. The PropRPM uses an LM2940 regulator which should be able to handle 1A, well beyond the LEDs' and the Prop's current requirement. What are you trying to run the PropRPM from? That may be your problem.
Back to Top
 

jknightandkarr
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Apr 2009
Total Posts : 57
 
   Posted 11/7/2009 10:03 PM (GMT -8)    Quote This PostAlert An Admin About This Post.
Well first I was using a 9V 900 mA transformer, now I"m using an old 486 style powersupply It's runing from, After measuring the powersupply out voltage & got 10.10 V & used a resistor voltage divider network to drop it too about 9.17V. Both had been giving me the same results.

Joe


I'm going insaine. It's SOOOOOO much fun. lol

Back to Top
 

Mike Green
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Oct 2004
Total Posts : 13554
 
   Posted 11/7/2009 10:10 PM (GMT -8)    Quote This PostAlert An Admin About This Post.
If you're using a voltage divider, that's your problem. As the current climbs because more LEDs are lit, the output voltage of the voltage divider will decrease and drop below about 4V at which time the supply voltage of the Prop will drop below 2.7V and it will reset.

A voltage divider will only provide a stable voltage when the current drain is fixed. Work it out using Ohm's Law. You'll see.

There's about a 0.7V drop across the input diode of the PropRPM plus about 0.5V across the voltage regulator. The Prop requires something like 2.7V or better to work and really is supposed to get 3.3V. You need at least 4.5V at the power connector. The Propeller datasheet has graphs showing how much current per cog it draws at different clock speeds plus a base current for the hub. Have a look at the datasheet.

Post Edited (Mike Green) : 11/8/2009 6:16:54 AM GMT

Back to Top
 

jknightandkarr
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Apr 2009
Total Posts : 57
 
   Posted 11/7/2009 10:53 PM (GMT -8)    Quote This PostAlert An Admin About This Post.
Thanks for telling me that. My electronics book I was looking at failed to give any info on that, other then how to do the calculations for doing them. Will remember that, much appreiciated. After I hooked my digital MM up to the proprpm board & with each led that came on, I watched the voltage drop down to about 3.7 V with the 8th led from about 8 volts idle, so that's my problem. I'm guessing my other 9V power supply will work just fine then. Thanks again.

Joe


I'm going insaine. It's SOOOOOO much fun. lol

Back to Top
 

jknightandkarr
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Apr 2009
Total Posts : 57
 
   Posted 11/7/2009 11:06 PM (GMT -8)    Quote This PostAlert An Admin About This Post.
After swaping out power supplies, I now get all 10 leds lit. Thanks. My other power supply was the problem. Thanks all!

Joe


I'm going insaine. It's SOOOOOO much fun. lol

Back to Top
 
[ << Previous Thread | Next Thread >> ]
New Topic Post Reply Printable Version
 
Forum Information
Currently it is Friday, November 20, 2009 10:14 PM (GMT -8)
There are a total of 393,733 posts in 55,521 threads.
In the last 3 days there were 83 new threads and 703 reply posts. View Active Threads
Who's Online
This forum has 17687 registered members. Please welcome our newest member, mark09.
52 Guest(s), 4 Registered Member(s) are currently online.  Details
Zoot, Chris Savage (Parallax), Nick McClick, Highlandtinker