hex to bin converter


Closed Thread
Results 1 to 2 of 2
  1. #1
    darkman's Avatar
    darkman Guest

    Default hex to bin converter

    Code:
    @ device XT_OSC,PROTECT_OFF,WDT_OFF,PWRT_ON,MCLR_ON,BOD_OFF,LVP_OFF,PROTECT_OFF,CPD_OFF
    TRISB=%00000000
    CMCON=7
    
        B0 var byte
        B1 var byte
    
    FOR B1=0 to 1
        LOOKUP B1, ["$3F $FF"],B0
    
    ' ==== B0 hex to bin convert here  ====
    
        PAUSE 200    
        PORTB.0=B0.7
        Pulsout PORTB.1,1
        PORTB.0=B0.6
        Pulsout PORTB.1,1
        PORTB.0=B0.5
        Pulsout PORTB.1,1
        PORTB.0=B0.4
        Pulsout PORTB.1,1        
        PORTB.0=B0.3
        Pulsout PORTB.1,1    
        PORTB.0=B0.2
        Pulsout PORTB.1,1    
        PORTB.0=B0.1
        Pulsout PORTB.1,1
        PORTB.0=B0.0
        Pulsout PORTB.1,1            
    LOW PORTB.1    
        
        NEXT B1
    I need hex to bin convert data in my B0
    please help

  2. #2
    Join Date
    Dec 2003
    Location
    Wichita KS
    Posts
    511


    Did you find this post helpful? Yes | No

    Default

    Hello Darkman,

    I don't understand what you want... but maybe using the bitshift command is what you are looking for....

    Data var byte;
    counter var byte

    For counter=0 to 7
    PORTB.0=Data.7 'assigns PORTB.0 the Bit Data.7 has (your part of the program).
    Pulsout PORTB.1,1 'your part of the program...
    Data=Data << 1 'shift left
    Next counter

    Unfortunately I really do not know what you are trying to accomplish... You assign Portb.0 a bit, but transmit out a pulse on Portb.1 (which is a different Port) Yet you never change the value of this POrtb.1... It is always the same.

    Dwayne
    Last edited by Dwayne; - 27th April 2005 at 14:50.
    Ability to Fly:
    Hurling yourself towards the ground, and missing.

    Engineers that Contribute to flying:
    Both optimists and pessimists contribute to the society. The optimist invents the aeroplane, the pessimist the parachute

    Pilots that are Flying:
    Those who know their limitations, and respect the green side of the grass...

Similar Threads

  1. Active low input?
    By CosMecc in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 8th August 2010, 20:31
  2. Configuration bits in a HEX file gone missing?
    By grzes.r in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 2nd February 2010, 01:10
  3. PIC16F877A pwm use for IR transmission
    By mcbeasleyjr in forum General
    Replies: 0
    Last Post: - 11th July 2009, 18:51
  4. How to convert HEX Value as formatted BIN String ?
    By Robson in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 19th August 2007, 02:16
  5. RS-232 async to sync converter
    By jmartin in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 11th October 2005, 23:04

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