Shop OBEX P1 Docs P2 Docs Learn Events
Questions about serial data transmission using the cog video hardware. — Parallax Forums

Questions about serial data transmission using the cog video hardware.

blackmesa82blackmesa82 Posts: 4
edited 2009-08-14 16:09 in Propeller 1
I am attempting to use the cog video hardware in 2-color VGA mode to serialize a 10-bit data packet for RS-232 transmission. The program is coded in Spin. When I initially setup the VCFG and the VSCL, before the first waitvid instruction, the output pin that is selected is either high or low. This initial state appears to be completely random after a processor reset.

Is there a way to set the initial output pin state before the first waitvid instruction? For RS-232 transmissions, I need this pin to be high by default.

Whatever the initial state of the output ends up being, it will always revert to that state between subsequent waitvid commands. It does not hold the last bit in the "pixel" stream. So if the output pin happens to start up high, it will always be high between transmissions. I am sending one character at a time, so the video serializer runs out of data after each 10 bit packet. Is there a way to set the pin state between waitvid instructions?

As a less important question, is there a way to clear the pixel and color data in the video hardware before or during the video configuration and setting up the PLLA? Sometimes after a reset, the serializer will send out a few bits of random data before any waitvid instruction is encountered.

Thanks for your help in advance.

- eeo

Comments

  • KyeKye Posts: 2,200
    edited 2009-08-14 15:05
    Hello, okay...

    First, the video hardware needs to be run continously. That is you must constantly feed it with data to keep the lines held right. Now, you can just set the pin state I belive first before enabling the video hardware and maybe that will work.

    ...

    Try setting the pin high first. Setting up the video hardware. Then sending all your packets to be transmited. Then change the video config so that it has no pins to output on. That way it should not conflict.

    Alos, note that you will not be able to transmit at low speeds without data trickery usign the video generator.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Nyamekye,
  • blackmesa82blackmesa82 Posts: 4
    edited 2009-08-14 16:09
    Thanks for suggestions. I forced the output high before configuring the cog video and that took care of the spurious data on startup.

    I found a solution to the default pin state problem. I simply padded the waitvid with ones on entry and exit and remove the forced high just before sending a packet and immediately reapply it afterwards.

    The following Spin code works from 110 baud to 115,200 (I can't test it any higher):

    pub CommTX(message) | data,i
    
    i~
    data := byte[noparse][[/noparse]message][i]
    
    repeat while data
    
      data <<= 1
      data |= %1_00000000_0
      
      waitvid(colors,$ffffffff)
      outa[noparse][[/noparse]HTX]~
      waitvid(colors,data)
      waitvid(colors,$ffffffff)
      outa[noparse][[/noparse]HTX]~~
      
      data := byte[noparse][[/noparse]message][noparse][[/noparse]++i]
    
    [/i]
    



    Thanks again.

    - eeo
Sign In or Register to comment.