??? 11/05/04 11:05 Read: times |
#80428 - RE: AT89S8252 SPI problem Responding to: ???'s previous message |
hi,
I CANT found any MASTER-SLAVE example code in assembler for AT89S8252 in web. Then you search bad. This forum: some subjects early http://www.8052.com/forum/read.phtml?id=80310 is was indicated: http://www.atmel.com/dyn/resou...oc4348.pdf This document contains both C and Asm examples. As well, at Atmel site in AT89S8252 product folder there is next document http://www.atmel.com/dyn/resou...OC1018.PDF which contains main SPI routines. As about your code. Here its piece: INTSPI: MOV A,SPSR ANL A,#SPIF JZ INTSPITrust me: never do such loops inside an interrupt service routine. Check for flags - yes, process them - yes. But do not insert any loops which have not defined number of itterations. This rule will help you in the future to avoid problems with "slow interrupts", "blocked interrupts" etc. I think the reason of the failure you described is that somehow slave lost one or more bytes due receive. It may be due noise, false clock detection etc. As result, data stream rolls and wrong byte is shown at port 2. I suggest you to use some handshake either via additional signal line or with a mark byte. With this way you will be able to indicate start of the new frame. And even mis-byte occures then it will be "recovered" at next frame. Regards, Oleg |
Topic | Author | Date |
AT89S8252 SPI problem | 01/01/70 00:00 | |
Try simplifying | 01/01/70 00:00 | |
RE: Try simplifying | 01/01/70 00:00 | |
RE: Try simplifying | 01/01/70 00:00 | |
RE: AT89S8252 SPI problem | 01/01/70 00:00 | |
RE: AT89S8252 SPI problem | 01/01/70 00:00 | |
handshake | 01/01/70 00:00 | |
RE: AT89S8252 SPI problem![]() | 01/01/70 00:00 |