Shop OBEX P1 Docs P2 Docs Learn Events
trying to control the PSC with the prop — Parallax Forums

trying to control the PSC with the prop

boeboyboeboy Posts: 301
edited 2007-06-25 01:34 in Propeller 1
Well i am trying to control the PSC with the prop but i can not seem to get it to work could somone look at my code and see if i am doing some thing wrong.

Post Edited By Moderator (Chris Savage (Parallax)) : 5/10/2007 3:59:07 PM GMT
«1

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-05-10 16:38
    You didn't include the definition of "scsf1". Some obvious problems:

    1) You're declaring the control strings as "long". This will put one character per long word (4 bytes) with the other bytes zero. You want to declare them as "byte".

    2) UART.tx will transmit one byte. In your "main" routine, you'll transmit the value "scsf1" as a single byte, that's all.

    3) You may want to use UART.str and pass it the address of a sequence of bytes. These byte strings HAVE to end with a zero byte. For example, you could have the declaration 'scbm1 byte "!SC",crs1,ra,mb,$0D,0' in your DAT section and then do "UART.str(@scbm1)" to send the string.

    4) Why are you using a mode value of 2 in your start() call? I thought the PSC used normal (non-inverted) mode for both transmit and receive (I could be wrong!). That would result in a mode of zero.
  • boeboyboeboy Posts: 301
    edited 2007-05-11 21:43
    Sorry about the lack of comments here is the code changed so that it has all the comments and I changed it to how you showed me, alas it still does not work with the BS2·or the prop·I can get the ver number with the·BS2·(it is 1.4) but I cannot control any servos.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    My computer, http://forums.parallax.com/showthread.php?p=630466

    Post Edited (boeboy) : 5/30/2007 7:11:30 PM GMT
  • boeboyboeboy Posts: 301
    edited 2007-05-11 22:37
    The PSC is still not working for the prop but it now works for the BS2 my problem·was that I left the jumper on that determines what servos it controls I had it set for 16-32 but I was trying to control 0-15 'LOL!'

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    lets see what this does... KA BOOM (note to self do not cross red and black)

    Post Edited (boeboy) : 5/14/2007 8:05:25 PM GMT
  • boeboyboeboy Posts: 301
    edited 2007-05-16 13:42
    Still can't get it to work with the prop here is my latest atempt


    :EDIT:forgot the code

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    lets see what this does... KA BOOM (note to self do not cross red and black)
  • boeboyboeboy Posts: 301
    edited 2007-05-16 13:45
    Oh and Mike you were right it is non-inverted.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    lets see what this does... KA BOOM (note to self do not cross red and black)
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-05-16 15:06
    Hello,

    Are you using a series resistor on the I/O line? Due to the design of the PSC it may not function with a series resistor which would typically be required on the Propeller. This may cause an incompatibility with this particular product. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • boeboyboeboy Posts: 301
    edited 2007-05-16 21:29
    No I am not.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    lets see what this does... KA BOOM (note to self do not cross red and black)
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-05-16 22:28
    If you have a scope you might want to see what levels the I/O pin is hitting when you’re sending serial data.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • Mike GreenMike Green Posts: 23,101
    edited 2007-05-17 00:10
    In your "main" method, you call UART.str(), then WAITCNT, then you call UART.tx().
    It looks like the 2nd call to the serial I/O should be UART.str().

    How about either hooking up a serial LCD display or using a little tv with a video output or some other kind of debug display
    so you can insert messages that say "I'm here and this worked" or "here's the value ..."?. It's not very useful to just say
    something didn't work. What happened and when? Even a couple of LEDs are handy to show you what progress you've made
    and when things happened or didn't happen.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-05-17 01:37
    My concern is that with a pull-up to 5V on the PSC and you’re using no series resistor there is already some current concerns.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • boeboyboeboy Posts: 301
    edited 2007-05-17 17:58
    Chris I do not have a scope. Mike reason than it is UART.str and then UART.TX is that i am trying them both with one download. So Chris·I might not be able to use the psc with the prop?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    lets see what this does... KA BOOM (note to self do not cross red and black)

    Post Edited (boeboy) : 5/17/2007 10:17:24 PM GMT
  • boeboyboeboy Posts: 301
    edited 2007-05-17 17:58
    oh and the pin works

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    lets see what this does... KA BOOM (note to self do not cross red and black)
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-05-17 18:56
    I just feel you’re probably drawing too much current without the series resistor and with it you probably won’t get the levels you need. I’d have to do some tests to be sure but I have a seen a similar situation with another device.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • boeboyboeboy Posts: 301
    edited 2007-05-17 22:17
    Thankyou all for all your impute on the mater I will be awaiting the results from your tests eagerly.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    lets see what this does... KA BOOM (note to self do not cross red and black)
  • boeboyboeboy Posts: 301
    edited 2007-05-20 21:28
    OK i have tried sending the data with the prop to hyperterminal and it seems to only be geting !SC what would cause this? and could this be my problem?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    lets see what this does... KA BOOM (note to self do not cross red and black)
  • boeboyboeboy Posts: 301
    edited 2007-05-28 00:23
    I still cannot get it to work if someone could give me some ideals it would be greatly appreciated!

    Thankyou.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    My computer, http://forums.parallax.com/showthread.php?p=630466
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-05-29 16:48
    Okay,

    ·· I did some testing this morning and I can talk to it just fine. My concerns are that in order to get enough pull-down I had to use a 220 ohm resistor, much less than we recommend for connecting 5V devices to the Propeller. As with the GPS interface there are no fancy or elaborate schemes for the connection, just a simple in-line/series resistor. Using the attached code I get ‘1.4’ on my terminal screen when running this program. Again, the current is what I would be concerned about. I hope this helps. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • KC8DKTKC8DKT Posts: 76
    edited 2007-05-30 08:50
    · Not sure if this will help but this is the test code I messed with to get the old PWMPal to work with the Prop just for fun.· I used a 260 ohm resistor for testing.· I switched this over to a small fet in the end to keep it safe.

    Post Edited (KC8DKT) : 5/30/2007 10:30:18 AM GMT
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-05-30 16:32
    That’s probably the safer answer…Driving the device with a transistor but you will lose two-way communication unless you add a second for the other direction. Of course, you’ll also have to invert the signals. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • boeboyboeboy Posts: 301
    edited 2007-05-30 19:08
    The program is works but I still can not control the servos I do not know why.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    My computer, http://forums.parallax.com/showthread.php?p=630466
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-05-30 20:28
    When you say the program works do you mean you’re getting the version? If so my guess is that you’re not sending the correct information for servo positioning…8 bytes need to be sent. Some are ASCII characters and others are binary values with the pulse width being a word value split into high/low bytes. Can you post the code you’re trying to use? That may give a clue as to what you’re doing wrong. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • boeboyboeboy Posts: 301
    edited 2007-05-31 00:36
    I can get the version of the psc with the BS2 and the PROP (with your program) ,and the program that I am useing is in my forth post.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    My computer, http://forums.parallax.com/showthread.php?p=630466
  • KC8DKTKC8DKT Posts: 76
    edited 2007-05-31 00:43
    · Like you said Chris,· you got a 220 working and the max I got to work was only a 260 ohm resistor.· Thats just not going to last too long.·
    ·
    · Dumb question,· I did some messing around with run'n the prop on 5v just for fun back then as well.· It was only talking "no leds being powered from the prop" and thing seemed to run just fine.·
    ·
    · What would be better·
    ··
    · Powering the prop from 5v to drive a 5v line "this would be easier on the diodes right?"··· OR·
    · Powering the prop from 3.3v to drive a 5v line with less than a 300 ohm resistor?
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-05-31 16:41
    Well, you cannot power the Propeller from 5V, so that removes option number one right there. Option number two is where we’re at with the issue of the pins being 5V tolerant to the extent of at extremely low current. To that end we recommend a 1K resistor be used on any 5V input into the Propeller. 220 (260) is just too low. It may survive and it may not. We cannot guarantee that it will though. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • boeboyboeboy Posts: 301
    edited 2007-05-31 21:56
    Ok I can now control a servo with the PSC and the prop the code i am useing is atached. But one way works and one·way does not work.·The way that does not work is below.
      full.str(string("!SC" ,CRS2, ra, sf, CR))
      full.tx(13)
    
    

    with full being FullDuplexSerial
    but when I try to use a string in a data block
    scfs1 byte "!SC",1,0,250,$0D,0
     
    
    

    ·
    and send it like this
    full.str(string(@scfs1))
    full.tx(13)
    

    It does not control the servo.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    My computer, http://forums.parallax.com/showthread.php?p=630466

    Post Edited (boeboy) : 5/31/2007 10:02:31 PM GMT
  • grindelgrindel Posts: 68
    edited 2007-06-04 02:49
    Chip,

    If you have it handy, would you give me an idea of the best way to wire the PSC up? I have read through the 5V interface sticky and there are a lot of options there, but I don't have the background to evaluate which would be better/safer. I hope you will also be able to supply specific part numbers for the transistors (if they are needed).

    Thanks
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-06-04 04:29
    Grindel,

    I believe I was already working on such an interface and there was some issue causing problems. If I get a chance tomorrow I will test my theory and post a schematic. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • grindelgrindel Posts: 68
    edited 2007-06-04 10:51
    Sorry, I wrote Chip. I meant Chris.

    Thanks for the response, I'm ordering parts soon so I wanted to be sure I had the correct components on hand after I got through the labs.

    Post Edited (grindel) : 6/4/2007 11:02:32 AM GMT
  • grindelgrindel Posts: 68
    edited 2007-06-13 17:06
    Just to bump this post, has there been any progress on this Chris?· I really appreciate the support.

    I have some ideas, but they are based on some possibly incorrect assumptions on how this connection works.·

    What I can gather is that the·"no data transfer" state of·the PSC is a steady +5V.· I'm not sure where the circuit grounds in this case. (high resitance ground in one or both chips?)· When one side wants to transfer data, it grounds the signal to a low resistance ground?

    I'll share·what I have come up with if the above assumptions are correct.

    The other option I have thought about is desoldering/cutting out the LED so I can use a 10K resister as with other 5V devices.

    I just·got my Prop working so I'll try out some ideas and report back as soon as I get parts in.······
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-06-13 20:10
    Grindel,

    I haven’t had time lately to test it…without some sort of level transitioning interface though it’s not going to work. Using a resistor large enough isn’t going to allow it to go low enough to register a logic 0. I remember testing a transistor interface for the RS-232 interface thread in the Completed Projects Forum. That worked, but again, at 5V.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
Sign In or Register to comment.