![]() |
![]() |
![]() |
|
|
|||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
|
|
Thread Tools | Display Modes |
|
|
(permalink) |
|
I'm looking to code a 16f84 PIC chip that makes a seven segment display output H E L P. I've looked all over the internet with no luck. I was wondering if anyone knew any code that would help?
many thanks |
|
|
|
|
|
|
(permalink) |
|
You just need to switch four different patterns to the display, you're unlikely to find EXACTLY what you want, because it's such a strange request - but it's trivial to do.
|
|
|
|
|
|
|
(permalink) |
|
I think this can be useful to you :
http://www.mikroe.com/en/books/picbook/7_08chapter.htm |
|
|
|
|
|
|
(permalink) |
|
hi,
If you use the good example that 'mabauti' has posted, you will have to extend the Bcdto7Seg table and pointers, to cover 'HELP'
__________________
Eric "Good enough is Perfect" PIC tutorials: Gramo's: www.digital-diy.net/ Bill's: www.blueroomelectronics.com/ |
|
|
|
|
|
|
(permalink) |
|
Here is the body of the code I wrote for you.The initialize part and the delay you can do.In this example PORTA connecting to common cathodes & segment pins connects to PORTB.
Note that With this simple method you can only show letters. Code:
;NOTES*********************************************************** ;COMMON CATHODE SEGMENTS DISPLAY "HELP" ;COMMON CATHODES SHOULD CONNECT TO PORTA ACORDING TO THIS TABLE ;SEGMENTS STARTING FROM LEFT TO RIGHT ;SEG4 SEG3 SEG2 SEG1 ;H E L P ;RA0 RA1 RA2 RA3 ;SEGMENT PINS SHOULD CONNECT TO PORTB ACORDING TO THIS TABLE ;SAME PINS LINKS TO OTHER SEGMENT PINS ;SEGMENT A-RB0 ;SEGMENT B-RB1 ;SEGMENT C-RB2 ;SEGMENT D-RB3 ;SEGMENT E-RB4 ;SEGMENT F-RB5 ;SEGMENT G-RB6 ;DELAY SHOULD BE ABOUT 10MS ;**************************************************************** HELLO MOVLW B'00001' ;TURN ON RA0 & OFF OTHERS MOVWF PORTA MOVLW B'1110011' ;DISPLAY LETTER P MOVWF PORTB CALL DELAY MOVLW B'00010' ;TURN ON RA1 & OFF OTHERS MOVWF PORTA MOVLW B'0111000' ;DISPLAY LETTER L MOVWF PORTB CALL DELAY MOVLW B'00100' ;TURN ON RA2 & OFF OTHERS MOVWF PORTA MOVLW B'1111001' ;DISPLAY LETTER E MOVWF PORTB CALL DELAY MOVLW B'01000' ;TURN ON RA3 & OFF OTHERS MOVWF PORTA MOVLW B'1110110' ;DISPLAY LETTER H MOVWF PORTB CALL DELAY GOTO HELLO |
|
|
|
|
|
|
(permalink) |
|
Gayan has provided a simple, elegant, intuitive example which should be more than enough to get the OP started.
|
|
|
|
|
|
|
(permalink) |
|
Code:
Device 16F877 Xtal = 4 Dim Number As Byte Initialization: TRISB = %00000000 ' Make PORTB all outputs Number = 0 ' Main: Number = 0 Repeat ' Create a loop Inc Number ' Increment the Number register GoSub Encode_Segment_Display ' Convert to segment data and display it DelaymS 500 ' Small delay to slow down counting Until Number = 4 ' Loop until number = 4, then reset Goto Main ' Loop forever Encode_Segment_Display: SELECT Number CASE 1 PORTB = %01110110 CASE 2 PORTB = %01111001 CASE 3 PORTB = %00111000 CASE 4 PORTB = %01110011 ENDSELECT Return Hope that helps (The circuit shows a "1" - its just a saved piccy on my site, watch the video to see "H E L P" displayed on the segment)
__________________
Spency. PIC Micro's - Your mind is the limit PIC's and interfacing with other devices - a PIC Basic Guide @ digital-diy.net Last edited by gramo; 2nd May 2007 at 02:14 PM. |
|
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Latest |
| Problem with LCD code? | spondootre | Micro Controllers | 15 | 29th April 2008 09:15 AM |
| Design 5 digits LED 7 segment display...(pH meter)! | ayien | Electronic Projects Design/Ideas/Reviews | 1 | 12th January 2007 08:43 AM |
| microchip application A590 /display is ok now | prosound90 | Micro Controllers | 20 | 18th November 2006 09:44 PM |
| Trouble with seven segment display. | Jeggyman | General Electronics Chat | 8 | 6th June 2004 12:18 AM |
| Convert Leds to 7 Segment Display | Almazick | General Electronics Chat | 21 | 19th August 2003 07:52 PM |