Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

programming advice needed 8051 program

Status
Not open for further replies.

gandalf_be

Junior Member level 1
Joined
Jun 12, 2003
Messages
15
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
193
Hello All,

I'm busy with writing a program that has to do the following:

I have a 16 bit value that is stored in two internal memory locations
At a certain moment i had to put the bitdata bit by bit to an IO/pin serial clocked on the rythme of an external clock connected at an IO pin (16 clock pulses). The 17th clock puls resets the value that was stored in the memory locations.

first method that i used was storing the data in normal internal data location and throug a rrc instruction the bit data comes on the io pin. this works fine but in a later stadium a had to do this for two 16 bit values at the same time.clocked at two different clocks .This means that i have to push and pop a lot because i'm only have one carry bit and accu.

I thought to be clever and stored my values in the bit addresable locations .by means of a pointer i could easily bring out the bit data.
after each clock pulse i incremented the pointer . but for some reason he refused to bring out the next databit. I can see with the debugger the values after incrementation of the pointer (viewing through A)
for some reason the programm refuse to used the incremented pointer value . I tried to use the set directive instead of equ but i doesn't seems to work eiher .


Please have a look in the small program in the attachment.


Ofcourse I could write the routine for each seperate bit 16 times but i want to avoid this.
Anybody has an idea how to solve this in a proper way without a lot of push and pops etc...

For your information i'm using a C8051F120 develeopment board from cygnal. with the Cycgnal IDE (keil )


Kind regards,

Gandalf
 

The easiest would be to use the built in hardware SPI Bus in slave mode to clock out the data at the MISO pin with an external clock connected to the SCK pin.
Look at page 253 in the daasheet:
**broken link removed**
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top