1 Replies - 2228 Views - Last Post: 16 November 2012 - 05:33 AM

#1 xamy  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 28
  • Joined: 06-May 12

displaying square of number on leds using 8051

Posted 15 November 2012 - 07:45 AM

hi! i am trying to get x from p1 and send square of x to p2. All the leds are on whether switches are open or closed. I have attached the print screen of proteus circuit. I have spend hours bt couldn't find out the problem. Please point out the problem.Attached Image

 ORG 00h
LJMP MAIN
DELAY:
;MOV R0,#2
MOV TMOD, #01H
MOV TH0, #HIGH (-50000)
MOV TL0, #LOW (-50000)
SETB TR0
JNB TF0, $
CLR TF0
CLR TR0
;DJNZ R0,DELAY
RET
MAIN:
MOV DPTR,#300H 
MOV A,#0FFH 
MOV P1,A 
BACK:
LCALL DELAY
MOV A,P1 
MOVC A,@A+DPTR
;MOV P2,#00H
;LCALL DELAY 
MOV P2,A 
SJMP BACK 
ORG 300H
XSQR_TABLE:
DB 0,1,4,9,16,25,36,49,64,81
END


Is This A Good Question/Topic? 0
  • +

Replies To: displaying square of number on leds using 8051

#2 turboscrew  Icon User is offline

  • D.I.C Addict

Reputation: 100
  • View blog
  • Posts: 624
  • Joined: 03-April 12

Re: displaying square of number on leds using 8051

Posted 16 November 2012 - 05:33 AM

I don't remember 8031/8051 too well, but:
Where do you configure the pins?

First you might try to copy the input (P1) to output (P2) "as is".

Do the LEDs reflect the state of the swithces?

If not, try to write 0x00 and 0xFF into P2 to see that the P2 pins are configured right.

Anyway, check this out (2.3 Input/Output Ports (I/O Ports))
http://www.mikroe.co...itecture/#ch2.3

This post has been edited by turboscrew: 16 November 2012 - 05:35 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1