Decimal to binary conversion


Closed Thread
Results 1 to 10 of 10

Hybrid View

  1. #1
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,170


    Did you find this post helpful? Yes | No

    Smile

    Hi Luciano,

    Yes, and no. Yes from the serial port, no from the terminal program, kinda. I'm using an RS232 chip into COM1. I'm using the serial window in IDE 'cause it's the only way I can transfer data down to the PIC. The reception variable is defined as VAR BYTE[5].

    You probably know my opinion of HyperTerminal if you read my post in the other thread. LOL I'm trying RealTerm, but I don't know what I have to set. I get the COM1 8N1 thing done, but I must be missing other key parameters 'cause I can't get it to work.

    My goal is to download a file in one instruction. Right now I'm sending parts of a record at a time manually. Good for testing, bad for final implementation. I have 2 sequential HSERINs for now:

    HSERIN recordtype

    IF recordtype = bla-bla-bla
    HSERIN recordformat
    ENDIF

    When I send "recordtype-recordformat" in one SEND, it doesn't work. I'm still trying to figure what I'm missing. I can send both separately, but I can't chain them in a single string and have the program treat data section by section.

    The plan is to add several other formats, and have them processed depending on the record type prefix. I'm still learning serial communication so I can quite easily have flaws in my approach. This works on main frames, but I'm not in Kansas any more.

    Robert

    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  2. #2
    Join Date
    Oct 2004
    Location
    Italy
    Posts
    695


    Did you find this post helpful? Yes | No

    Default

    Hi Robert!


    The following will also work.

    ========================================
    Pseudo-Code:

    ee_address VAR WORD
    SERIN2 RxPin,84,[DEC5 ee_address]

    ========================================

    Type the decimal number 62347 in
    your PC terminal program.


    After receiving the 5 ASCII bytes
    the SERIN2 command will store the
    decimal value 62347 in the
    variable ee_address.

    See PBP manual for SERIN2 modifiers, works
    also with command HSERIN and HSERIN2.


    Luciano

  3. #3
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,170


    Did you find this post helpful? Yes | No

    Red face

    Uhhh, so you're saying I'm doing this conversion for nothing?

    Robert
    LMAO!
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

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


    Did you find this post helpful? Yes | No

    Default

    Uhhh, so you're saying I'm doing this conversion for nothing?
    Indeed dude.

    I'm trying RealTerm, but I don't know what I have to set. I get the COM1 8N1 thing done, but I must be missing other key parameters 'cause I can't get it to work.
    go to 'pin' tab then uncheck RTS and DTR... you'll be in business. Chances are because you're using an ICD adapter and those pins force your chip to reset.... that's it IMHO. OR you type in text box... you can send number

    pretty sure HSEROUT is not working also ?!?

    My goal is to download a file in one instruction. Right now I'm sending parts of a record at a time manually. Good for testing, bad for final implementation.
    you may need 1 or 2 extra flow control pin for that to avoid dumb or messy download. 1 to tell the pic you're going to receive data, one from the pic to the PC to confirm you receive a byte and you're ready to receive another.
    Steve

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

  5. #5
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,170


    Did you find this post helpful? Yes | No

    Default

    Thanks, but oh poop...

    I guess I'm not finished getting this darned RS232 download to work if I'm a couple pins short.

    Robert
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

Similar Threads

  1. Binary Coded Decimal
    By -Dan- in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 25th May 2009, 09:23
  2. Help for decimal conversion
    By eva in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 15th March 2007, 18:20
  3. microns to decimal conversion
    By Rleonard in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 28th February 2007, 14:37
  4. Decimal to Binary Conversion
    By schlaray in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 23rd December 2006, 14:58
  5. Binary to Decimal from ADC
    By RYTECH in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 27th July 2005, 18:51

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