DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Serial port and WinAMP vis plugin help (YASPQ?)

Hybrid View

  1. #1
    Join Date
    Feb 2006

    Serial port and WinAMP vis plugin help

    Edit: GOT IT. do not need to read! thanks!

    Hello all,
    I am working on a personal project that uses a PIC16F876 to control a couple of RGB LEDs. Here is a link to my worklog if you would like to peruse: RGBSoda

    I've got the firmware for the PIC mostly done and a protocol implemented for serial communication working. (It is based on the protocol code at, but ported to pic assembly)

    I can change the color of the specified LED by sending the appropriate command string.

    Naturally, changing the LED colors via HyperTerminal can get a little boring, so I wanted to make a WinAMP plugin that would control the device...

    I got the sample vis plugin source from and went at it. Found tons of tutorials and code snippets on accessing the serial port via the API CreateFile and WriteFile, etc ,etc. Not too hard to simply write one line out and be done with it...

    Here comes my question:
    The Render function inside the winamp plugin gets called every 25ms, and here is where I put my: (off the top of my head, code isn't infront of me now)
    bWrite =WriteFile(hComm, "#010101FFFF00\r",14,&bytesWritten);
      MessageBox(this_mod->parentHwnd, "Didn't Write", "Error",MB_OK);
    so essentially just writing the same thing every time the Render function is called. (Actually I have it alternate colors based on a flag, so you can see if its actually getting the data...)
    It will write to the port very intermittently (definetly not 25ms intervals) and then it will bomb out, and i will start getting the "Didn't Write" messagebox.

    Changing the delay of the Render function to, lets say, 100ms, only delays the time until WriteFile will stop working...

    I know timing issues in Windows can be a #@#$, especially at small intervals like 25ms..but is there any way to accomplish my goal? Is it possible to send data out the serial port this fast? Am I missing something? Overlapped I/O? Do I need to go multithreaded? Do you think my firmware is the culprit? (I'm not sure how, even if my firmware sucks, why would it cause the serial port to stop writing?)

    I usually end up writing a novel trying to be as specific as I can, but I always manage to leave something important out, so if you see some glaring omission, please let me know so i can provide more details. I'm pretty close to finishing this project as this is one of the final features I'd like to implement.

    Thank you for your time and I look forward to your insight,
    Last edited by Dext3r; 02-21-2006 at 02:24 AM.

  2. #2
    Join Date
    Feb 2006
    yup, i suck. i forgot i put a bunch of 1ms delays in my firmware for testing and didnt take them out...

    oh boy...

    it works fine now. i suck. sorry to waste your time!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center