free 8051 Microcontroller Projects AVR PIC Microcontroller Projects Tutorials Ebooks Libraries, interfacing tutorials, lcd tutorial, stepper motor, dc motor 8051 assembly language programming electronics and communication ECE CSE pdf ebooks library BE final year project ideas Embedded systems

 
8051 microcontroller 8051 microcontroller
Forums

Moderators: Ajay, Junied , abbas1707, Arun Kumar V, pdi33, Shailesh NAYAK, ۞ TPS ۞, shyam, sashijoseph
Author Post
Colin Mac
Mon Jul 28 2008, 02:47PM
 User Offline
Registered Member #4338
Joined: Wed Oct 10 2007, 05:46AM

Posts: 56
Thanked 0 times in 0 posts
I want to send characters to Hyperterminal from 8051. Please let me know if my connections and code are right.

8051 TX -> MAX232 T1in.... MAX232 T1out -> PC RX

=====

9600 baud. 11.0592 MHz. 8 bits. 1 stopbit. No parity.
CODE:

clr sm0
setb sm1
MOV TMOD, #20H
MOV TH1, #253
MOV A, PCON            
clr ACC.7              
MOV PCON, A     
mov SCON, #50H ;8b, 1stop, 1start, REN enabled
GAIN: mov SBUF, #'A' ;letter A is transmitted
HERE: jnb TI, HERE
clr TI
sjmp GAIN
end

Thanks

Back to top


Arun Kumar V
Mon Jul 28 2008, 07:32PM

 User Offline
Registered Member #426
Joined: Sun Jan 28 2007, 11:50PM

Posts: 427
Thanked 178 times in 149 posts

Hi Mac,

the max232 connection seems to be correct, the code doesn't work bcoz you haven't started the timer1, here's the modified code:


CODE:
MOV TMOD, #20H
MOV TH1, #253
ANL PCON,#7FH  
MOV SCON, #50H ;8b, 1stop, 1start, REN enabled
SETB TR1

GAIN: MOV SBUF, #'A' ;letter A is transmitted
HERE: jnb TI, HERE
clr TI
sjmp GAIN
end


all the best !


Arun
Back to top


sashijoseph
Mon Jul 28 2008, 07:32PM

 User Offline
Registered Member #5870
Joined: Mon Feb 04 2008, 06:26PM

Posts: 524
Thanked 124 times in 117 posts
Connections are OK.
In the code you've forgotten to start the timer (setb TR1).
Some lines are superfluous...since you've already set SCON to 50H there's no need to explicitly clr and set smo and sm1.
On reset,the PCON D7 bit is cleared automatically,so you can do away with those 3 lines as well.

EDIT : Seems Arun and I posted at the same time..

[ Edited Mon Jul 28 2008, 07:34PM ]

Let there be music........
Back to top


Colin Mac
Mon Jul 28 2008, 08:54PM
 User Offline
Registered Member #4338
Joined: Wed Oct 10 2007, 05:46AM

Posts: 56
Thanked 0 times in 0 posts
ok thanks a lot guys
Back to top


Colin Mac
Sun Aug 03 2008, 10:49AM
 User Offline
Registered Member #4338
Joined: Wed Oct 10 2007, 05:46AM

Posts: 56
Thanked 0 times in 0 posts
That worked. Now I'm trying to send 'A' from one micro to another to turn on a led. Can you let me know if you see a problem?
CODE:

MOV TMOD, #20H
MOV TH1, #244 ;2400
ANL PCON,#7FH  
MOV SCON, #50H ;8b, 1stop, 1start,
SETB TR1

send:
MOV SBUF, #'A' ;letter A is transmitted
jnb TI, $
clr TI
jmp send
end

CODE:

MOV TMOD, #20H
MOV TH1,  #244  ;2400
ANL PCON, #7FH  
MOV SCON, #50H ;8b, 1stop, 1start, REN enabled
SETB TR1

setb p1.7
start:
JNB RI, $ ; wait for an entire byte to be received
CLR RI ; the receive interrupt flag is set by hardware but must be cleared by software
MOV A, SBUF;
CJNE A, #'A', start
clr p1.7
jmp $
end
 

Back to top


sashijoseph
Sun Aug 03 2008, 08:45PM

 User Offline
Registered Member #5870
Joined: Mon Feb 04 2008, 06:26PM

Posts: 524
Thanked 124 times in 117 posts
seems ok....

Let there be music........
Back to top


Colin Mac
Mon Aug 04 2008, 07:18AM
 User Offline
Registered Member #4338
Joined: Wed Oct 10 2007, 05:46AM

Posts: 56
Thanked 0 times in 0 posts
I think it's working now. Cheers.


[ Edited Mon Aug 04 2008, 10:19AM ]
Back to top


 

Jump:     Back to top

Syndicate this thread: rss 0.92 Syndicate this thread: rss 2.0 Syndicate this thread: RDF
Powered by e107 Forum System

8051 Microcontroller Projects 8051 AVR tutorials PIC microcontroller, 8051 assembly language programming electronics and communication ECE CSE pdf ebooks library BE final year project ideas Embedded systems