Serin serout problem


Closed Thread
Results 1 to 40 of 337

Hybrid View

  1. #1
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by lerameur View Post
    ok TRied the easy Prog Programmer,
    http://www.embedinc.com/easyprog/index.htm
    does not work more, same thing, I meam .. nothing is happening...
    Just curious, is the chip a 16F876 or a 16F876A.... there's a difference as far as programming method goes...

  2. #2
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    it is the 876A and 877A BOTH

  3. #3
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    I also have te Pic18F4685, PBP do not have a file to compile this...
    How do I go about making an Hex file out of it ??
    Last edited by lerameur; - 7th January 2007 at 17:36.

  4. #4
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    ok I am doing a remote control for my robot I wrote a code below, It seems long, Maybe you have a better idea. I am using two Potentiometer , the values of each will control the left and right motor of the robot:

    'Remote control*****************

    direction var word : speed var word

    Loop:
    If (left => 115) AND (left <= 135) AND (right => 115) AND (right <= 135) then
    goto stop

    If (left => 115) AND (left <= 135) AND (right <= 115) then 'left is stop, right is CCW
    goto LeftstopRightCCW

    If (left => 115) AND (left <= 135) AND (right => 135) then 'left is stop , right is CW
    goto LeftstopRightCW

    If (right => 115) AND (right <= 135) AND (right <= 115) then 'right is stop, left is CCW
    goto RightstopLeftCCW

    If (right => 115) AND (right <= 135) AND (right => 135) then 'right is stop , left is CW
    goto RightstopLeftCW

    If (left > 135) AND (right > 135) then 'Left Cw & right CW
    goto LeftCWRightCW

    If (left > 135) AND (right < 135) then 'Left CW & right CCW
    goto LeftCWRightCCW

    If (left < 135) AND (right > 135) then 'Left CCW & right CW
    goto LeftCCWRightCW

    If (left < 135) AND (right < 135) then 'Left CCW & right CCW
    goto LeftCCWRightCCW

    In brief:
    'Stop '--------------------------------$69 = 01 10 10 01
    'Leftwheel =stop : Rightwheel= CCW '--- $A6 = 10 10 01 10
    'Leftwheel =stop : Rightwheel= CW '----- $96 = 10 01 01 10
    'Leftwheel =CCW : Rightwheel= stop '---- $9a = 10 01 10 10
    'Leftwheel =CW : Rightwheel= stop '----- $A5 = 10 10 01 01
    'Leftwheel =CW : Rightwheel= CW '---- $66 = 01 10 01 10
    'Leftwheel =CW : Rightwheel= CCW '---- $56 = 01 01 01 10
    'Leftwheel =CCW : Rightwheel= CW '---- $5a = 01 01 10 10
    'Leftwheel =CCW : Rightwheel= CCW '---- $65 = 01 10 01 01
    Last edited by lerameur; - 7th January 2007 at 22:29.

  5. #5
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by lerameur View Post
    ok I am doing a remote control for my robot I wrote a code below, It seems long, Maybe you have a better idea. I am using two Potentiometer , the values of each will control the left and right motor of the robot:

    'Remote control*****************

    direction var word : speed var word

    Loop:
    If (left => 115) AND (left <= 135) AND (right => 115) AND (right <= 135) then
    goto stop

    If (left => 115) AND (left <= 135) AND (right <= 115) then 'left is stop, right is CCW
    goto LeftstopRightCCW

    If (left => 115) AND (left <= 135) AND (right => 135) then 'left is stop , right is CW
    goto LeftstopRightCW

    If (right => 115) AND (right <= 135) AND (right <= 115) then 'right is stop, left is CCW
    goto RightstopLeftCCW

    If (right => 115) AND (right <= 135) AND (right => 135) then 'right is stop , left is CW
    goto RightstopLeftCW

    If (left > 135) AND (right > 135) then 'Left Cw & right CW
    goto LeftCWRightCW

    If (left > 135) AND (right < 135) then 'Left CW & right CCW
    goto LeftCWRightCCW

    If (left < 135) AND (right > 135) then 'Left CCW & right CW
    goto LeftCCWRightCW

    If (left < 135) AND (right < 135) then 'Left CCW & right CCW
    goto LeftCCWRightCCW

    In brief:
    'Stop '--------------------------------$69 = 01 10 10 01
    'Leftwheel =stop : Rightwheel= CCW '--- $A6 = 10 10 01 10
    'Leftwheel =stop : Rightwheel= CW '----- $96 = 10 01 01 10
    'Leftwheel =CCW : Rightwheel= stop '---- $9a = 10 01 10 10
    'Leftwheel =CW : Rightwheel= stop '----- $A5 = 10 10 01 01
    'Leftwheel =CW : Rightwheel= CW '---- $66 = 01 10 01 10
    'Leftwheel =CW : Rightwheel= CCW '---- $56 = 01 01 01 10
    'Leftwheel =CCW : Rightwheel= CW '---- $5a = 01 01 10 10
    'Leftwheel =CCW : Rightwheel= CCW '---- $65 = 01 10 01 01

    You're right. There probably is a better/shorter way to do that.
    I'll think about it for a bit and get back to ya.
    I take it that the reason you've got 115 and 135 is for a bit of a 'deadband' so the thing doesn't jitter on you?

    (see that?, the manchester encoding is handy isn't it?)

    How about


    'Remote control*****************

    direction var word : speed var word
    bits var byte
    'bits = bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0
    ' LCW (-LCW) LCCW -(LCCW) RCW (-RCW) RCCW (-RCCW)
    'use odd bits as a direction flag, use the even bits inverted from the others as the same thing, but also as a bit of error detection

    TX end...

    Loop:
    bits = %01010101

    If (left => 115) AND (left <= 135) then bits.7 = 0 : bits.6 = 1
    if (right => 115) AND (right <= 135) then bits.3 = 0 : bits.2 = 1
    if (right <= 115) then bits.1 = 1 : bits.0 = 0
    If (right => 135) then bits.3 = 1 : bits.2 = 0
    If (left <= 115) then bits.5 = 1 : bits.4 = 0
    If (left => 135) then bits.7 = 1 : bits.6 = 0
    transmit
    goto loop


    RX end....
    In brief:
    if bits.7 = bits.6 then bitserror 'bit pairs shouldn't be equal
    if bits.5 = bits.4 then bitserror
    if bits.3 = bits.2 then bitserror
    if bits.1 = bits.0 then bitserror

    'Stop '--------------------------------$69 = 01 10 10 01
    'Leftwheel =stop : Rightwheel= CCW '--- $A6 = 10 10 01 10
    'Leftwheel =stop : Rightwheel= CW '----- $96 = 10 01 01 10
    'Leftwheel =CCW : Rightwheel= stop '---- $9a = 10 01 10 10
    'Leftwheel =CW : Rightwheel= stop '----- $A5 = 10 10 01 01
    'Leftwheel =CW : Rightwheel= CW '---- $66 = 01 10 01 10
    'Leftwheel =CW : Rightwheel= CCW '---- $56 = 01 01 01 10
    'Leftwheel =CCW : Rightwheel= CW '---- $5a = 01 01 10 10
    'Leftwheel =CCW : Rightwheel= CCW '---- $65 = 01 10 01 01

    And at the receiver end, the receiver code wouldn't actuate a motor until receiving a few correct codes in a row (a one time code wouldn't trip the motors into running).

    Just a quick thought I had...

  6. #6
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    I got the module working now, I will be doing some testing thursday.
    by the way i wouls like to have a crystal oscillate by itself, How do i do that ? I have a sensor chip that needs to be clocked. I tried connecting it to + and ground but nothing

  7. #7
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by lerameur View Post
    I got the module working now, I will be doing some testing thursday.
    by the way i wouls like to have a crystal oscillate by itself, How do i do that ? I have a sensor chip that needs to be clocked. I tried connecting it to + and ground but nothing
    Crystals don't oscillator by themselves. In short, you have to have a small inverting amp, induce a phase shift, and a few other things to get a usable signal from them. Grab the datasheet for a 4066 and see what they do with a crystal and one of those chips. Or just buy a DIP oscillator of the frequency of your choice (Digikey ECS oscillators).

  8. #8
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by lerameur View Post
    I also have te Pic18F4685, PBP do not have a file to compile this...
    How do I go about making an Hex file out of it ??
    Upgrade to 2.47...

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. PIC16f877 code crosses boundary @800h
    By inventosrl in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 6th April 2009, 23:03
  3. serout and serin problem
    By nicolelawsc in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 11th April 2006, 20:44
  4. Replies: 11
    Last Post: - 13th July 2005, 20:26
  5. SerIn and SerOut
    By Dwayne in forum FAQ - Frequently Asked Questions
    Replies: 0
    Last Post: - 21st July 2004, 16:54

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