The temperature sensor was connected to 8 LEDs provided with the DeccanRobots package, successfully displaying the temperature in binary format. However, when attempting to use a microcontroller with a program designed to output the temperature on 4 seven-segment displays (also included in the DeccanRobots package), the output showed "29.9". Additionally, increasing the temperature with the LM5 sensor did not yield any changes, while the LED display continued to function correctly.
The provided assembly code illustrates a program designed to read a temperature value and display it on four seven-segment displays. The program utilizes various registers and memory locations to represent digits and their corresponding binary values.
The program begins by initializing the data segment and clearing the display registers for each digit. The main loop calls several subroutines to retrieve the temperature value, convert it into individual digits, and display these digits on the seven-segment displays.
The `GETNUM` subroutine reads a value from the temperature sensor connected to port P1, divides the value to extract each digit, and stores these digits in registers R0, R1, and R2. The `AHUNDS`, `ATENS`, and `AONES` subroutines are responsible for converting the digits into their corresponding binary representations for the hundreds, tens, and units places, respectively.
The `DISPLAY` subroutine sequentially activates each digit's display and sends the corresponding binary value to the output port P2. A delay is included after each display update to ensure the output is visible. The program loops indefinitely, constantly reading the temperature and updating the display accordingly.
The assembly code also includes a delay routine that uses timer interrupts to create a pause between updates, ensuring the display does not flicker. This structure allows for real-time temperature monitoring using the microcontroller and the DeccanRobots package components.
The overall design demonstrates an effective integration of hardware and software for displaying temperature readings in a user-friendly format, utilizing both LED and seven-segment display technologies. I plugged the temperature onto 8 LEDs (I'm using a DeccanRobots package, and so this was supplied with the board). It worked, showing the temperature in binary form . Now when I tried using my microcontroller with this program I wrote to output the number on 4 7-segments(also included in the DeccanRobots package), it ended up showing me "29.9".
And when I touched the LM5 to make the temperature increase, nothing happened. transferring it back to the LEDs, it would work. ORG 0 ;P1 EQU 11111111 DIGIT1 EQU P3.0 DIGIT2 EQU P3.1 DIGIT3 EQU P3.2 DIGIT4 EQU P3.3 ZERO EQU 01110111b ONE EQU 01000001b TWO EQU 00111011b THREE EQU 01101011b FOUR EQU 01001101b FIVE EQU 01101110b SIX EQU 01111110b SEVEN EQU 01000011b EIGHT EQU 01111111b NINE EQU 01101111b DOT EQU 10000000b PDATA EQU P2 MOV PDATA,#00h CLR DIGIT1 CLR DIGIT2 CLR DIGIT3 CLR DIGIT4 MAIN: ACALL GETNUM ACALL AHUNDS ACALL ATENS ACALL AONES ACALL DISPLAY ACALL DELAY JMP MAIN GETNUM: MOV A, P1 MOV B, #100 DIV AB MOV R0, A ; 1st digit MOV A, B MOV B, #10 DIV AB MOV R1, A ; 2nd digit MOV R2, B ; 3rd digit RET AHUNDS: MOV A, R0 FZERO: CJNE A, #0, FONE MOV R3, #ZERO FONE: CJNE A, #1, FTWO MOV R3, #ONE FTWO: MOV R3, #TWO RET ATENS: MOV A, R1 SZERO: CJNE A, #0, SONE MOV R4, #ZERO SONE: CJNE A, #1, STWO MOV R4, #ONE STWO: CJNE A, #2, STHREE MOV R4, #TWO STHREE: CJNE A, #3, SFOUR MOV R4, #THREE SFOUR: CJNE A, #4, SFIVE MOV R4, #FOUR SFIVE: CJNE A, #5, SSIX MOV R4, #FIVE SSIX: CJNE A, #6, SSEVEN MOV R4, #SIX SSEVEN: CJNE A, #7, SEIGHT MOV R4, #SEVEN SEIGHT: CJNE A, #8, SNINE MOV R4, #EIGHT SNINE: MOV R4, #NINE RET AONES: MOV A, R2 TZERO: CJNE A, #0, TONE MOV R5, #ZERO TONE: CJNE A, #1, TTWO MOV R5, #ONE TTWO: CJNE A, #2, TTHREE MOV R5, #TWO TTHREE: CJNE A, #3, TFOUR MOV R5, #THREE TFOUR: CJNE A, #4, TFIVE MOV R5, #FOUR TFIVE: CJNE A, #5, TSIX MOV R5, #FIVE TSIX: CJNE A, #6, TSEVEN MOV R5, #SIX TSEVEN: CJNE A, #7, TEIGHT MOV R5, #SEVEN TEIGHT: CJNE A, #8, TNINE MOV R5, #EIGHT TNINE: MOV R5, #NINE RET DISPLAY: setb DIGIT1 MOV A,R3 MOV PDATA,A LCALL DELAY CLR DIGIT1 setb DIGIT2 MOV A,R4 ORL A,#DOT MOV PDATA,A LCALL DELAY CLR DIGIT2 setb DIGIT3 MOV A,R5 MOV PDATA,A LCALL DELAY CLR DIGIT3 RET DELAY: MOV TMOD,#01h MOV TH0,#240 Wait: setb TR0 JNB TF0,Wait CLR TF0 CLR TR0 RET 🔗 External reference
A circuit for monitoring supply voltages of ±5 V and ±12 V can be constructed as shown in the diagram. It is significantly simpler than the typical monitors that utilize comparators and AND gates. The circuit is not designed...
The PIC Microchip Processor must be programmed before it will function as a Volt & Amp meter. There are many internet sites and PIC programmers that you can use. I used a Microchip MPLAB ICD 2 during the project....
T-121 temperature sensor electronic thermometer circuit diagram shown below
The T-121 temperature sensor circuit is designed to measure and display temperature readings accurately. The circuit typically consists of a temperature sensor, such as the T-121, which converts temperature variations into...
The temperature detection circuit is illustrated in Figure 10. This circuit comprises a temperature sensor, a voltage-to-frequency (V/F) converter, an oscillator, a control program for testing, an alarm system, and a decoding and display circuit. The temperature sensor used...
The output becomes high when a predetermined temperature is surpassed. A fixed half-supply reference voltage provides a reference current to the inverting input, while a variable current is supplied to the non-inverting input. Resistor R6 functions as a negative-temperature-coefficient...
The TCA965 window discriminator IC enables the use of potentiometers RV1 and RV2 to configure the window height and window width, respectively. Resistor R1 and thermistor TH1 form a potential divider connected across the supply lines. Resistor R1 is...
We use cookies to enhance your experience, analyze traffic, and serve personalized ads.
By clicking "Accept", you agree to our use of cookies.
Learn more