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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
06/22/06 08:06
Read: times


 
Msg Score: +1
 +1 Good Answer/Helpful
#118832 - talking about standard '51...
Responding to: ???'s previous message
In the following I assume a pretty standard off-the-shelf vanilla flavour 8051 (although it may be strawberry if one prefers that).

Richard Erlacher said:
I'm not sure there's a ready way for a PC to talk to a device interfaced with an 805x in mode-0.

If th UART is eaten up for the SPI-like task, there are at least three quite straighforward ways to interface a '51 to PC:
1. use LPT on PC and connect the micro in "parallel"
2. use an external-data-memory-mapped 16C550 or alike
3. bit-bang a 1200bps UART on the '51, it's actually very easy and examples lie around in pi... - ehm - heaps

Richard Erlacher said:
If he wants to go REALLY slowly, then he can bit-bang.

Bah. Consider (clock&latch levels/edges are arbitrary here):
;data to be shifted out are in acc; returns data shifted in in acc
   clr   LATCH  ;latch the input data
   mov   r2,#8  ;prepare counter
loop:
   mov   c,MISO ;input data bit
   rrc   a      ;data are LSB first
   mov   MOSI,c ;output data bit
   clr   CLK    ;advance shift
   setb  CLK
   djnz  r2,loop
   ret

That's 70 cycles on the vanilla, including call and ret. Sure it is more than some 10 cycles needed for
   mov   dptr,#portaddress
   movx  @dptr,a
   movx  a,@dptr
   ret
but I doubt the "overhead" for the input/output data manipulation will be less than several tens of cycles, so what's up?

Richard Erlacher said:
I've already gone on at some length about the 805x's weaknesses in synchronous communication via mode-0. The standard 12-clockers can't do it at all, since the data rate is oscillator/12 and that's the instruction rate as well. There isn't time to turn a loop in which one either responds to an interrupt or checks the status of the RI or TI bits, moves a byte in the appropriate direction, and clears the RI or TI bit when you have only eight instruction cycles. This renders the classic Mode-0 serial channel useless for syncrhonous communication.

Not quite so. In fact, you don't need to check/write ri/ti at all, simply count your cycles. Note that in fact it takes some 9-10 12-clock cycles to shift out a (8-bit) byte, so there *is* some time for data processing. And if the data preparation takes more it doesn't really matter, as the UART mode 0 is master-only. The only real concern here is, that it is in fact single direction.

Jan Waclawek

List of 34 messages in thread
TopicAuthorDate
74hc595/597 connection with c51            01/01/70 00:00      
   Any available port pin            01/01/70 00:00      
   I'd suggest you read the datasheet            01/01/70 00:00      
      little more info as u require richard            01/01/70 00:00      
         start it simple and stupd            01/01/70 00:00      
   bit-bang            01/01/70 00:00      
      problem is ...            01/01/70 00:00      
         talking about standard '51...            01/01/70 00:00      
            That's why I want to "fix" it ...            01/01/70 00:00      
         there is'nt so why do you proselytize f            01/01/70 00:00      
            PC's are async, Mode-0 is not            01/01/70 00:00      
               I know that, but 99.17% of all '51 UART            01/01/70 00:00      
                  Do you know what UART means?            01/01/70 00:00      
                     A resounding NO. I use synchrono            01/01/70 00:00      
                        SPI??? Is that in the "bible"            01/01/70 00:00      
                           no, it is not - but it is a very well de            01/01/70 00:00      
                              You're well into nonsense, now, Erik            01/01/70 00:00      
                              you just ignore the real reason            01/01/70 00:00      
                                 This may be a valid topic, but not here.            01/01/70 00:00      
                                    Whenever you use shift registers for I/O            01/01/70 00:00      
                                       Doesn't SPI have a bunch of "features?"            01/01/70 00:00      
                                          yes, we ARE mixing, both threads touch s            01/01/70 00:00      
                                             I don't want to confuse the O/P ...            01/01/70 00:00      
                                                that would be wrong            01/01/70 00:00      
                                                   I think we've lost the O/P            01/01/70 00:00      
                           this may be the answer to your 'prayers'            01/01/70 00:00      
                              Thanks, but which prayers are those?            01/01/70 00:00      
                                 those for a fast synchronous communicati            01/01/70 00:00      
                                    I don't want to use a commercial chip            01/01/70 00:00      
                                       why not            01/01/70 00:00      
                                          If I want to use SPI, I'll build it in            01/01/70 00:00      
                  Do you know what UART means?            01/01/70 00:00      
                     ^%$#@! I didi it again!            01/01/70 00:00      
   Depends on your needs...            01/01/70 00:00      

Back to Subject List