Serout problem


Results 1 to 40 of 95

Thread: Serout problem

Threaded View

  1. #11
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default serial wireless transmitter code

    'after you've got everything else set up

    led1toggle = $56 : led2toggle = $59 : led3toggle = $5a : led4toggle = $65
    ledson = $66 : ledsoff = $69
    ledswing = $6a

    START:
    gosub trainreceiver : serout portb.2, n2400, [ ledsoff ] : pause 1000
    gosub trainreceiver : serout portb.2, n2400, [ ledson ] : pause 1000

    goto start

    trainreceiver:
    serout portb.2, n2400, [ $aa, $aa, $aa, $aa, $aa ] : return

    end



    See that? Every time you send a command you have to train the receiver because there is more than about 5ms between commands. If you were to continuously send commands or data, you probably wouldn't need to train the receiver. But in any case, you MUST use manchester encoding! You'll get garbage at the output if you don't!
    As this code is setup, all your LEDs should come on for a second, turn off for a second, come on for a second, etc.etc...
    Let me know what happens...
    JDG

    Ok, I just saw the post about using the pot. So use the pot to turn the LEDs on and off. Then after that works, use the POT to turn the LEDs on in sequence to match the pot's rotation.

    gosub trainreceiver : serout portb.2, n2400, [ ledsoff ]
    if b0 < 64 then gosub trainreceiver : serout portb.2, n2400, [ led1toggle ]
    if ( b0 > 63 ) and ( b0 < 128 ) then gosub trainreceiver : serout portb.2, n2400, [ led2toggle ]
    if ( b0 > 127 ) and ( b0 < 192 ) then gosub trainreceiver : serout portb.2, n2400, [ led3toggle ]
    if ( b0 > 191 ) then gosub trainreceiver : serout portb.2, n2400, [ led4toggle ]
    Last edited by skimask; - 2nd December 2006 at 18:44.

Similar Threads

  1. A Serial GLCD 128x64 Simple Project
    By Oldspring in forum Off Topic
    Replies: 0
    Last Post: - 8th March 2010, 21:58
  2. Serout to serial servo
    By azmax100 in forum mel PIC BASIC Pro
    Replies: 20
    Last Post: - 12th August 2009, 17:46
  3. Advice-scrutiny for my serial controller
    By kevlar129bp in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 13th December 2008, 18:11
  4. Strange SerOut Problem
    By masosi in forum mel PIC BASIC Pro
    Replies: 39
    Last Post: - 23rd April 2007, 07:06
  5. Replies: 11
    Last Post: - 13th July 2005, 20:26

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts