Shop OBEX P1 Docs P2 Docs Learn Events
Elexol SX48 upgrade USB->PWM — Parallax Forums

Elexol SX48 upgrade USB->PWM

lamedustlamedust Posts: 3
edited 2008-03-21 16:25 in General Discussion
Hello group! I'm new here, and to the world of micro-controller programing. I'm a comp sci major and I'm working on this project that requires me to output PWM signals through USB.

I bought a USBIO module to keep the electronics simple so I can work on the programming, but I have a question

1) Will the computers clock speeds outputting through serial commands to a USB->FTDI->SX48 to activate a pin be fast enough to generate smooth PWM?

The product is here:
http://www.elexol.com/IO_Modules/USB_IO_24.php
http://www.elexol.com/Download/documents/USBIO24Rds1.pdf

They sent me their code to update when I asked them if I could get PWM. I know the SX48 can do this. But I'm so new at this how complicated would it be to reprogram the Elexol code so that when I output a serial signal it let's the SX48 know that it should output a PWM signal at x% on y pin#.

Current code to output a signal: MSComm1.Output = "B128" will output a high on pin 8

So my second question is:

2) Has anyone upgraded Elexol's code to output PWM? If not, is it something that I can do fairly easily... Lastly could anyone help?

_BG!

Post Edited By Moderator (Bean (Hitt Consulting)) : 3/20/2008 5:53:29 PM GMT

Comments

  • BeanBean Posts: 8,129
    edited 2008-03-20 17:57
    _BG,
    · Are you allowed to post their code ? If so please do.
    · Otherwise I don't know how we could give you an informed answer.

    · The SX48 has two PWM channels. So if you don't need any more than 2 PWM outputs it should be do-able.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    www.iElectronicDesigns.com

    ·
  • lamedustlamedust Posts: 3
    edited 2008-03-21 12:19
    I guess so, they don't have any limits when they sent it to me:
    The file is attached (i think) thanks for the response!
    -bg
  • BeanBean Posts: 8,129
    edited 2008-03-21 13:23
    bg,
    I assume you have an SX-Key or SX-Blitz to re-program the board ?

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    www.iElectronicDesigns.com

    ·
  • lamedustlamedust Posts: 3
    edited 2008-03-21 15:56
    It's on the way, I just bought one.
    -bg
  • BeanBean Posts: 8,129
    edited 2008-03-21 16:25
    Okay,
    I have NO IDEA if this will work, but try it and see (when you get the programmer).
    You send a "P", On_LSB, On_MSB, Off_LSB, Off_MSB (so five bytes in total).

    The board runs at 4mhz, so the On and Off times are at 4MHz.

    To run though the PWM output levels you could do something like:

    FOR I =0 TO 255
    · SEROUT "P", I, 0, (255-I), 0 ' "0" is a zero
    · PAUSE 100
    NEXT

    Something like that will will generate a 15.6KHz PWM output that varies in duty cycle.

    NOTE that the PWM output is on SX pin RB.6 which I think if port A, pin 3, I/O 7 ???
    You may have to make that pin an output first.

    Let me know if the code works.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    www.iElectronicDesigns.com



    Post Edited (Bean (Hitt Consulting)) : 3/21/2008 4:30:14 PM GMT
Sign In or Register to comment.