garbage var from pulsin,,


Closed Thread
Results 1 to 13 of 13

Hybrid View

  1. #1
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    well what to say to this one. If you receive your data with the PIC it will be already the great value, don't mix Terminal operation and PIC operation..

    If by example your PC will get your value from the PIC, you can only send it like this
    SEROUT PORTB.0,4,[Myvar1,Myvar2,Myvar3]

    and leave it like this. Your PC software will get the right value of your var. Case you want to work with string, you'll have to get each character and do the ASCII to decimal conversion... not handy and so much time spending.

    PIC to PIC. Send your data same as above and receive the same way.

    Master: SEROUT PORTB.0,4,[Myvar1,Myvar2,Myvar3]

    SLAVE : SERIN PORTA.0,4,[Myvar1,Myvar2,Myvar3]

    OR maybe i didn't understand your question....

    Sending text+Value of a var on a terminal:
    SEROUT PORTB.0,4,["Myvar1 : ",#Myvar1," Myvar2 : ",#Myvar2,13,10]
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  2. #2
    PICMAN's Avatar
    PICMAN Guest


    Did you find this post helpful? Yes | No

    Default

    indeed i was not clear, when i use purely ascii, i get prouduct i ecpect, for example 149 at zero,, but if i try to convert to DEC it gives me junk, i wish to use logic to say

    if PLS = 143 - 153 then rled =0 : lled = 0
    if pls > then 153 then lled = 1
    if PLS < 143 then rled = 1

    my problem, is the only way i can see to refrence the varible, is in ascii format, so i need to know how to type ascii text, in my pbp program,

    finished prouduct will have NO serout and will be self running, no pc conected, i just conect bs2 to pc to see how i can interact with var PLS,, which i have found i get the numbers i expect with out hassle in ascii format,, so i believe if i can use ascii formatt in my program ,, i can logically creat a flow, like above, but with out dec format,, not 149 , o with 2 circles above, but i am unsure if i can use ascii in program , i know for bianary i use %0000 0000,, i call this refrencing bianary, how do i refrence ascii, and how do i type out ascii characters,

    originally i planed to use code identical to above, but i find isues when i tell debug to read out dec format, so since i get numbers i know are what i need in ascii, i wish to refer to these values in ascii, to prevent garbage results, since ascii gets me what i need, and shows corasponding interaction when i controll sevo via remote , values change acordingly
    in dec format they donot

    or am i over thinking this, if i type code as above will it work, it seems to me the pic should know 149 = o with 2 circles above, (ascii )
    Last edited by PICMAN; - 21st February 2005 at 21:15.

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    you can't refer to ascii to do your stuff.

    if (PLS <153) AND (PLS> 143) then
    rled =0
    lled = 0
    endif
    if pls > then 153 then lled = 1
    if PLS < 143 then rled = 1

    this already work as you wish.

    you can also refer to binary
    if (PLS <%10011001) AND (PLS> %10001111) then
    rled =0
    lled = 0
    endif
    if pls > then %10011001 then lled = 1
    if PLS < %10001111 then rled = 1

    Or in hexadecimal
    if (PLS <$99) AND (PLS> $8F) then
    rled =0
    lled = 0
    endif
    if pls > then $99 then lled = 1
    if PLS < $8F then rled = 1


    If you want to receive value from PC and convert it to decimal
    SERIN2 PORTB.0,16780,[dec3 loop]

    this will receive 3 character and convert it to decimal value from your terminal.

    If you want to send 123 to pic type 123, if you want to send 10 type 010 and that's it
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  4. #4
    PICMAN's Avatar
    PICMAN Guest


    Did you find this post helpful? Yes | No

    Default

    awsome so i was thinking to hard, if i read 149 at "zero" (in ascii text off bs2)
    then i can refer to this value in pbp, as 149 and it will work,

    this means my design works perectly,

    ty

  5. #5
    PICMAN's Avatar
    PICMAN Guest


    Did you find this post helpful? Yes | No

    Default why it weas garbage and how to fix it,

    ok, the numbers we were thinking are too low look around the 700 regon,, connect the servo batery negitive to the bs2 or pic - power suply,, since the pulse is sent on hi,,, the negitives must be conected for the ic wether (pic or bs2) and the servo pack, other wise you get the junk output, once this conection is made every thing works ,, with dramatically simple coding

Similar Threads

  1. RF Modules
    By tonyfelloni in forum mel PIC BASIC Pro
    Replies: 44
    Last Post: - 26th June 2010, 17:42
  2. RS485 bus - starting probem
    By wurm in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 27th January 2010, 13:35
  3. Puzzling issue with I2CWRITE to 24LC512
    By aberco in forum General
    Replies: 4
    Last Post: - 22nd August 2008, 17:47
  4. 16F877 RAM Question
    By Art in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 6th August 2005, 11:47
  5. 18F6680 and portd problems.
    By jkbh in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 6th June 2005, 10: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