Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
10/01/09 09:26
Modified:
  10/01/09 09:36

Read: times


 
Msg Score: +1
 +1 Good Question
#169322 - TEMPERATURE MONITORING DEVICE USING AT89C51
Hi! I've been working on a project for my computer architecture class. I selected this project and, somehow, I'm stuck.

It's a temperature monitoring device using LM5 and an AT89C51 as the microcontroller.

Now before using the microcontroller, 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. What can be wrong with my program?

here is my program (quite lengthy, mind you) and the circuit diagram




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

 



List of 28 messages in thread
TopicAuthorDate
TEMPERATURE MONITORING DEVICE USING AT89C51            01/01/70 00:00      
   Divide your problem into parts            01/01/70 00:00      
      ADC is working fine            01/01/70 00:00      
   29.9 is what you implemented            01/01/70 00:00      
      I don't get it.            01/01/70 00:00      
         OR this way also            01/01/70 00:00      
         Did you try?            01/01/70 00:00      
            Debugging techniques            01/01/70 00:00      
            tried it            01/01/70 00:00      
   Test your Display routines using DIP switches            01/01/70 00:00      
   Excellent question            01/01/70 00:00      
      agreed, but one thing missing            01/01/70 00:00      
         8 data lines for 7-seg            01/01/70 00:00      
            I see no con2 connections on your schematic and ...            01/01/70 00:00      
               also            01/01/70 00:00      
               CON2 is good.            01/01/70 00:00      
         7 segments, plus DP            01/01/70 00:00      
            the 8 data lines are each segment + dot            01/01/70 00:00      
      Thank you            01/01/70 00:00      
   Look at your code            01/01/70 00:00      
      You're right            01/01/70 00:00      
         First try to solve the simplest things like DELAY            01/01/70 00:00      
   Problem Solved!            01/01/70 00:00      
      We ought to have this as an example of a well-framed query!            01/01/70 00:00      
         Absolutely            01/01/70 00:00      
            Fix the FAQs?            01/01/70 00:00      
            agreed, but there is one fly in the ointment            01/01/70 00:00      
               it's not a big fly            01/01/70 00:00      

Back to Subject List