BCD conversion


Closed Thread
Results 1 to 10 of 10

Thread: BCD conversion

Hybrid View

  1. #1
    Macgman2000's Avatar
    Macgman2000 Guest


    Did you find this post helpful? Yes | No

    Smile

    Hello All,

    I have the hardware set up using an LM393 (0v to -1.55v) to shift to standard TTL/CMOS. I am able to see the data by setting the calipers to 1" and analyzing the waveform to get 20480 (which is the resolution per inch) . It is being clocked out LSB to MSB. I have the PIC packing 3bytes but like I said it is backwards.

    I have most of the supporting readout code done and tested with dummy variables. The only thing holding me up is flipping the data around and scaling it (scaling factor already worked out). I will fiddle around with your suggestion.

    Thanks again!!!

    Best Regards,
    Nick

  2. #2
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    762


    Did you find this post helpful? Yes | No

    Default

    Nick, here is a ready to run Code Snippet that does the conversion:

    Code:
    InBuffer VAR BYTE[3]
    CounterA VAR BYTE
    
    Main:
    
    ' Bits are shifted into an Array of Byte (InBuffer) here (LSB first)
    '  
    ' Place your Code to shift the bits in here...
    
    
     FOR CounterA = 0 TO 2
            
         'Revert the Bit order
         InBuffer[CounterA] = Inbuffer[CounterA] REV 8
    
         'Invert captured Data (if not required comment this line out)
         InBuffer[CounterA] = InBuffer[CounterA]^$FF
     
     NEXT CounterA
    
     'Output Raw Data to LCD (24 Bits, MSB first)
      LCDOUT BIN8 InBuffer[2],Bin8 InBuffer[1],Bin8 InBuffer[0]
     
    GOTO Main
    regards

    Ralph

    _______________________________________________
    There are only 10 types of people:
    Those who understand binary, and those who don't ...
    _______________________________________________



  3. #3
    Macgman2000's Avatar
    Macgman2000 Guest


    Did you find this post helpful? Yes | No

    Smile

    Thanks Ralph !!!! I will try it out this week.....geez, right now I have an urgent request for a speed controller FETs'n all ....hehehe.

    Best Regards,
    Nick

  4. #4
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    762


    Did you find this post helpful? Yes | No

    Default

    Hi Nick,

    RE: your PM

    I haven't found time yet to work on this project.

    It certailny is possible in PBP,
    a 70-90 kHz clock is not that fast, so a tight loop could do.

    Another option is to use the MSSP Module.

    I'll have a look into it when I find time.
    regards

    Ralph

    _______________________________________________
    There are only 10 types of people:
    Those who understand binary, and those who don't ...
    _______________________________________________



Similar Threads

  1. A/D conversion with PIC18F67J50
    By ScaleRobotics in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 8th May 2009, 01:48
  2. A/D conversion problem in 18F2520, 2523, 2550 etc.
    By selimkara in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 10th March 2008, 16:26
  3. Rotary BCD
    By Tobias in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 15th October 2007, 03:04
  4. Strange A/D conversion...
    By Christos_K in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 5th June 2005, 01:35
  5. HEX to BCD conversion
    By Don Mario in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 2nd February 2005, 14:39

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