Parallel Com Port

Discussion in 'Questions (Windows Mobile)' started by hawkeyetim, Aug 8, 2009.

  1. hawkeyetim

    hawkeyetim Member Licensed User

    Hi Guys
    Is it possible to control the input and output of the printer port using basic4ppc as i wish to control some stepping motors. I was wondering if the serial library would do the job or is that only for the serial port. :sign0104:

    Thanks
    Tim
     
    Last edited: Aug 8, 2009
  2. RandomCoder

    RandomCoder Well-Known Member Licensed User

    Hi hawkeyetim,

    You can't control the parallel port directly, but you could use a serial to parallel converter. I've done this on a print capture program and it works a treat. Some converters are bi-directional and allow to send and recieve data.

    Regards,
    RandomCoder.

    PS If you shop round you can find then relatively cheaply Aten SXP-500 serial to parallel converter on eBay (end time 11-Aug-09 23:03:52 BST)
    THIS IS BY NO WAY AN ENDORSEMENT TO BY FROM THIS SELLER!!!!!
     
  3. taximania

    taximania Well-Known Member Licensed User

    Hi Hawk.
    How about using a microchip pic instead of the parallel port.
    There's more pins available, and there's bound to be stepper motor
    control software already written for a pic.

    Infrared, bluetooth and serial port control are all available from Basic4ppc.

    See my website page for more details.
     
  4. hawkeyetim

    hawkeyetim Member Licensed User

    Thanks Guys
    Think am off down the usb controller route as I've found some descent hardware to control the stepping motors with a dll library for control but whether its compatible with basic4ppc i don't know as its written for C so i might have to learn a new language (bugger):sign0080:

    Hawk
     
  5. Ariel_Z

    Ariel_Z Active Member Licensed User

    Does it have a .net version?
     
  6. hawkeyetim

    hawkeyetim Member Licensed User

    not really sure its says the following

    Although the DLL was written in ā€žCā€Ÿ it can be used (called) by programs written in a number of popular languages, the most popular of which is BASIC (Visual BASIC). Described below are the techniques to use the DLL in Visual Basic and C++. If you program in another language please refer to your compiler manual on the details of calling a C++ library function, which will be very similar to the techniques described below.

    the web address is Stepper Motor Control from a USB Port
     
  7. taximania

    taximania Well-Known Member Licensed User

    Downside:

    The dll can't be downloaded from their website.
    It's supplied with purchases.

    I've also had no luck connecting anything to a Pocketpc via USB.
     
  8. hawkeyetim

    hawkeyetim Member Licensed User

    think am going to order one later and hopfully it will work will basic4ppc and desktop if not its visual basic time. will let you know what happens.
     
  9. Ariel_Z

    Ariel_Z Active Member Licensed User

    I created a simple Basic4ppc wrapper for the dll. This exposes the needed functions (according to their documentation) and should work. NOTE: I did not test it, so please let me know (you can also by PM or Ariel@basic4ppc.com) if it works.

    What you need to do:
    1. Download.
    2. Place in the application folder.
    3. Place the DLL you got from them (you bought) in the same folder.
    4. In Basic4ppc, add StpMotor4ppc.dll to your program and add an object with the same name (unfamiliar with libraries? see libraries tutorial).
    5. I called mine stp, and so you now can write:

    Code:
    stp.New1
       stp.InitStp
       stp.RunMotor1(
    1010105)
       stp.StopMotor1(
    5)
    Let me know if it works!
     

    Attached Files:

    Last edited: Aug 30, 2009
  10. hawkeyetim

    hawkeyetim Member Licensed User

    what a brillitant forum this is.
    thanks Ariel_Z :sign0098:.
    i've ordered all my parts and with the help of ariel_z and everyone else i should have working motors soon. will post again once everything is in place and hopfully working

    Hawk
     
  11. hawkeyetim

    hawkeyetim Member Licensed User

    :sign0060:

    yep it works great Ariel
    Thanks your a star

    Hawk
     
  12. Ariel_Z

    Ariel_Z Active Member Licensed User

    Excellent! I'm happy to hear... could you please post some photos so that we can see the real thing?? I'm curious...
     
  13. hawkeyetim

    hawkeyetim Member Licensed User

    Will send pics when i receive the stepping motors have only tested the outputs with LED's at the moment. Should get them in the next few days.
    I'll probably be here (forum) quite a bit over the next few months to get my project off the ground.

    Hawk
     
  14. Ariel_Z

    Ariel_Z Active Member Licensed User

    We will be happy to assist...
     
  15. hawkeyetim

    hawkeyetim Member Licensed User

    Hi Ariel_Z

    Have a problem with the GetCurrentStatus command which i can not get to work. It comes back with a weird error any help appreciated as always.
    All the other commands work fine.

    Thanks


    Code :
    Sub Globals
    'Declare the global variables here.
    Dim m1,m2,s1,s2,i
    End Sub

    Sub App_Start
    stp.New1
    stp.InitStp
    stp.RunMotor1(1000,10,0,0)
    stp.GetCurrentStatus(m1,m2,s1,s2,i)


    End Sub


    Error :
    An error ocurred in sub main.app_start

    line number: 10

    stp.GetCurrentStatus(m1,m2,s1,s2,i)
    error description
    Attempted to read or write protected memory. This is often an
    indication the other memory is corrupt.
     
  16. agraham

    agraham Expert Licensed User

    I'm afraid that it's a library error. Ariel needs to recompile the library with a different signature for GetCurrentStatus, the parameters to that function should be passed by reference but he is passing them by value. He will either need to return an array with the values or add a few properties to pass the information back into Basic4ppc as it cannot cope with parameters passed by reference to a library.
     
  17. Ariel_Z

    Ariel_Z Active Member Licensed User

    Agraham is right.
    I did what he said. What we end up with right now is this: Instead of the GetCurrentStatus function you now have 5 different functions. They are, M1Active, M1Steps, M2Active, M2Steps, and Inputs. Use them instead of the original method.
    Each one calls the method separately when called. Depending on what you plan to do, there might be a small performance loss (I guess not). If so, let me know and I'll create something a bit faster (though less simple, that's why I decided to do it like that).
     

    Attached Files:

  18. hawkeyetim

    hawkeyetim Member Licensed User

    Thanks Guys for the quick reply and solution.
    Won't be able to test until tomorrow now but will let you know how it goes.
    :sign0060:
    Thanks Again
     
  19. hawkeyetim

    hawkeyetim Member Licensed User

    Hi YA
    Just finished testing and all commands are work absolutely fine. Regarding performance no issue at the moment it takes about 50/1000 of a second to call the command which should be plenty fast enough.

    Thanks Ariel_Z


    here is also a link to video i posted on youtube just showing motors spinning (really sad i know)

    YouTube - telescope control step 1
     
  20. Ariel_Z

    Ariel_Z Active Member Licensed User

    Looks really good. If you need any help please let us know. What is the final purpose of the project?
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice