The TIL311 is a texas instruments 7 segment display that can be used in microcontroller projects.
http://members.ziggo.nl/electro1/avr/til311.htm
Here is the data sheet
Used this convert binary to BCD
https://www.tutorialspoint.com/binary-to-bcd-conversion-in-8051
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; TIL311 test | |
; Some starter code comes from Tom Hayes, Learning the Art of Electronics | |
; https://learningtheartofelectronics.com/ | |
; Binary to BCD from https://www.tutorialspoint.com/binary-to-bcd-conversion-in-8051 (George John) | |
; When single stepping in Silabs on the 8051F410, two TIL311 registers will count up from 0. | |
$NOSYMBOLS ; keeps listing short.. | |
$INCLUDE (C:\MICRO\8051\RAISON\INC\c8051f410.inc) | |
ORG 0 ; tells assembler the address at which to place this code | |
SJMP STARTUP ; here code begins--with just a jump to start of | |
; real program. ALL our programs will start thus | |
ORG 80h ; ...and here the program starts | |
STARTUP: acall USUAL_SETUP | |
ACALL IO_SETUP | |
CLR A | |
MOV P2, A | |
MOV R7, A | |
COUNT: MOV A, R7 | |
INC A | |
MOV R7, A | |
ACALL CONVERT | |
MOV P2, R3 | |
SJMP COUNT | |
USUAL_SETUP: ; Disable the WDT. | |
anl PCA0MD, #NOT(040h) ; Clear Watchdog Enable bit | |
; Enable the Port I/O Crossbar | |
mov XBR1, #40h ; Enable Crossbar | |
ret | |
IO_SETUP: orl P0MDOUT, #01h ; enable P0.0 as push-pull output | |
RET | |
CONVERT: | |
MOV A, R7 ;Takethe data into Acc | |
MOV B, #0Ah ;LoadB with AH = 10D | |
DIV AB ;DivideA with B | |
MOV R5, B ;Storethe remainder | |
MOV B,#0Ah ;LoadB with AH = 10D | |
DIV AB ;DivideA with B | |
MOV R2, A ;Store the MS portion | |
MOV A, B ;LoadB content to A | |
SWAP A ;Swapthe nibbles | |
ADD A,R5 ;Addstored remainder with A | |
MOV R3,A | |
RET | |
END | |