|
From: Gernot F. <g....@gm...> - 2005-06-20 04:37:17
|
On Mon, 20 Jun 2005, you wrote:
> Hi Peter,
>=20
> --- Peter <pl...@ac...> wrote:
> >
> >=20
> > NOT TANGO ONER, TANGO INDIA. You made a typo. Sigh.
> >=20
>=20
> Yup, I did. Sorry about that. Next time I'll
> definitely double check :-)
>=20
> Also, I have another quick question. How would you
> write the code if you didn't want to use the standard
> serial TXD pin on the 2051 and were to use a general
> I/O pin like P1.7? This would free up the built in
> serial pins so I can use them for communicating with a
> PC.
this works with software-serial in an interrupt.
The interrupt must run 5 times the baudrate.
p1.2 and p1.3 are used.
void sendch(char c)
{
=09while(sec!=3D0);
=09sed=3Dc;
=09sec=3D10;
}
char getch()
{
=09while(byteready=3D=3D0);
=09byteready=3D0;
=09return recbuf;
}
void timer0int(void) interrupt 1
{ =20
=20
_asm
djnz _timer0int_sendps_1_1,00005$
mov a,_sec
jz 00001$
cjne a,#10,00002$
clr _P1_3
sjmp 00003$
00002$: ;c is set from cjne !
mov a,_sed
rrc a
mov _P1_3,c
mov _sed,a
00003$: dec _sec
00001$:
mov _timer0int_sendps_1_1,#5
00005$:
djnz _timer0int_recps_1_1,00011$
inc _timer0int_recps_1_1
jb _reciving,00010$
jb _P1_2,00011$
setb _reciving
mov _timer0int_recpu_1_1,#255
mov _timer0int_recps_1_1,#3
sjmp 00011$
00010$:
mov _timer0int_recps_1_1,#5
mov c,_P1_2
mov a,_timer0int_recpu_1_1
rrc a
mov _timer0int_recpu_1_1,a
jc 00011$
setb _byteready
mov _recbuf,a
clr _reciving
00011$: =20
_endasm=09 =20
=20
}
>=20
> Thanks again and sorry about the really n00bish
> mistake :-)
>=20
> J Silverman
>=20
>=20
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around=20
> http://mail.yahoo.com=20
>=20
>=20
> -------------------------------------------------------
> SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
> from IBM. Find simple to follow Roadmaps, straightforward articles,
> informative Webcasts and more! Get everything you need to get up to
> speed, fast. http://ads.osdn.com/?ad_id=3D7477&alloc_id=3D16492&op=3Dcl=
ick
> _______________________________________________
> Sdcc-user mailing list
> Sdc...@li...
> https://lists.sourceforge.net/lists/listinfo/sdcc-user
--=20
MFG Gernot
|