12f675_fuse_about_to_blow!


Results 1 to 40 of 929

Threaded View

  1. #24
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,621


    Did you find this post helpful? Yes | No

    Default

    Henrik, so are we're saying that the program is counting up from 0-9 in bytes? Does it load and output the values $00000000 (LOOP1) $00000001 (LOOP2) ...etc. If that's the case I could directly output to a seven segment display!
    Yes and no, the loop incements the variable i from 0 to 9 (or what ever you want it to) and writes its value to the GPIO-register, the pattern on the GPIO will be the binary representation of the number, ie:

    00000000 '0
    00000001 '1
    00000010 '2
    00000011 '3
    ...
    00001000 '8
    00001001 '9

    This however, can not drive a 7-segment display directly as displaying "1" needs two segments turned on (but only one bit is set on the "count" of 1) and 8 needs all seven segments on but at the "count" of 8 there's again only a single bit set.

    However, you can use the LOOKUP command to "translate" the 0-9 count into the "patterns" needed to drive the segments. Lets say you connect the display so that each bit drive the segments as per the attached picture. To display "3" bit 0, 1, 2, 3 and 6 would need to be set, or put another way, you'd need to write %01001111 or 79 to the port. To display a "2" you need to set bits 0, 1, 3, 4 and 6 (%01011011 or 91) and so on.

    Now lookup the LOOKUP command in the manual ;-)
    Attached Images Attached Images  

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