??? 03/14/06 19:07 Read: times |
#112156 - Pattern Generator Responding to: ???'s previous message |
Maybe one of the members can give me help with program?
It runs pseudo random generator but not very well. I took this out of one my books on 8051 microcontrollers. I also ran it on simulator it runs with out errors but pseudo random generator part is really bad. 89c2051 running at 4 Mhz power at 5v source P1.0---7 connected to leds P3.0---7 connected to leds program should not repeat for about 4 hours ;Mainline org 0 ;execution starts here loop: ;loop here forever mov c,p3.2;get the bits to and together cpl psw.7;invert bit 13 anl c,p3.7;and it with bit 15 mov acc.0,c ;save it for later mov c,p3.7;now get bit 13 * ! bit 15 cpl psw.7 anl c,p3.2 orl c,acc.0;orboth values together in carry mov a,p1;now update the 16 led display rlc a mov p1,a mov a,p3 rlc a mov p3,a acall dlay;leave like this for 500 msec sjmp loop;loop around again dlay: ;delay 263 msec clr a mov b,#0 ;longest delay possible dlayloop: loop here for 500 msec djnz acc,dlay loop ;inside loop djnz b,dlayloop ret This should light 16 leds in pseudo random pattern. But I run on simulator it looks like it know where near pseudo random pattern. Best reguards, Ralph Sack |