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 03:26
Modified:
  10/01/09 03:36

Read: 3898 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        JR Requiroso      10/01/09 03:26      
   Divide your problem into parts      Mahesh Joshi      10/01/09 03:59      
      ADC is working fine      JR Requiroso      10/01/09 04:05      
   29.9 is what you implemented        Juergen Christoph      10/01/09 04:17      
      I don't get it.      JR Requiroso      10/01/09 04:35      
         OR this way also      Mahesh Joshi      10/01/09 04:45      
         Did you try?      Andy Neil      10/01/09 04:49      
            Debugging techniques      Andy Neil      10/01/09 04:55      
            tried it      JR Requiroso      10/01/09 05:21      
   Test your Display routines using DIP switches      Mahesh Joshi      10/01/09 04:21      
   Excellent question      Steve M. Taylor      10/01/09 06:23      
      agreed, but one thing missing      Erik Malund      10/01/09 06:27      
         8 data lines for 7-seg      JR Requiroso      10/01/09 06:38      
            I see no con2 connections on your schematic and ...      Erik Malund      10/01/09 07:35      
               also      Erik Malund      10/01/09 13:02      
               CON2 is good.      JR Requiroso      10/03/09 09:20      
         7 segments, plus DP      Andy Neil      10/01/09 06:46      
            the 8 data lines are each segment + dot      JR Requiroso      10/01/09 08:54      
      Thank you      JR Requiroso      10/01/09 06:30      
   Look at your code      Jerson Fernandes      10/01/09 08:23      
      You're right      JR Requiroso      10/01/09 08:53      
         First try to solve the simplest things like DELAY      KONSTANTINOS L. ANGELIS      10/01/09 10:46      
   Problem Solved!      JR Requiroso      10/02/09 01:11      
      We ought to have this as an example of a well-framed query!      Richard Erlacher      10/02/09 08:55      
         Absolutely      Steve M. Taylor      10/02/09 12:43      
            Fix the FAQs?      Andy Neil      10/03/09 01:40      
            agreed, but there is one fly in the ointment      Erik Malund      10/03/09 07:00      
               it's not a big fly      Richard Erlacher      10/03/09 12:32      

Back to Subject List