Shop OBEX P1 Docs P2 Docs Learn Events
Problem with a simple serial application — Parallax Forums

Problem with a simple serial application

JabberwockJabberwock Posts: 2
edited 2009-01-11 23:31 in Propeller 1
Greetings,

Please bear with me, as I have no experience with controllers whatsoever - in fact, if I succeed with this program, I will not touch low-level stuff for a long time...

I am trying to write a simple program for Brilldea's excellent LED Painter. The creator of the LED Painter has provided me with the drivers which allow me to control the board - it all works very well.

However, I do not wish to go the DMX route - I would like to control the board directly with the Prop Plug. I thought that it would be relatively simple - just get the data and adjuct the LEDs accordingly... Unfortunately, it did not go that well... I cannot even establish a proper serial communication. For example, I try to test FullDuplexSerial procedures (with a Pure Data and with a simple VB app):

Serial.start(31, 30, 1, 9600)

repeat

test := Serial.rx

if test <> 0

Serial.tx (test)


The values I get back are certainly not what I send out - in fact, they are quite random, even if I send the same value all the time... What am I doing wrong?

Comments

  • StefanL38StefanL38 Posts: 2,292
    edited 2009-01-11 21:49
    Hello Jabberwork,

    the third parameter in serial.start is the mode

    '' mode bit 0 = invert rx
    '' mode bit 1 = invert tx
    '' mode bit 2 = open-drain/source tx
    '' mode bit 3 = ignore tx echo on rx
    
    
    



    with value "1" you inverted the rx-pin

    try it with ,ode 0

    code]
    Serial.start(31, 30, 0, 9600)
    [noparse][[/noparse]/code]

    and be sure that you have the same baudrate in your VB-App

    another hint:

    you have to set these constants
    as without them the propeller runs in internal oscillator mode, which has NO accurate frequency

    CON    
      _clkmode = xtal1 + pll16x
      _xinfreq = 5_000_000
    
    



    best regards

    Stefan
  • JabberwockJabberwock Posts: 2
    edited 2009-01-11 23:31
    Thank you, the mode was wrong indeed. Now it works as it should!
Sign In or Register to comment.