Anyone

Jul 03, 2024 Last reply: 2 years ago 9 Replies

Hello



Anybody here? Wish some help on 89c2951


Probably best to ask your actual question about that chip.

Not saying I can actually provide any useful help though.

Thanks for your response. My problem is programs do not work when tested on breadboard.

Basically I am a retired Mechanical Engineer with some electronics basics. There ia a need for a motor drive to switch clockwise and anticlockwise using a L298 that just needs HHL and HLH on 3 pins for driving the motors clockwise and anti.

My 89c2051 programmer and the assembler are ok. The first program below works well as rogrammed, using 32.768 crystal. The program was assembled and burnt by me.

The second program that is aupposed to operate 12 seconds of clockwise and anticlockwise, behaves erratic when tried on breadboard and leds. But it works ok in the emulator!

sorry for the long post but I do not feel I can explain otherwise.

Many thanks in advance for your time and help.

Program No 1 working ok with 32.786 crystal

ORG 0 mov sp,#030h ajmp main

ORG 0Bh mov th0,#0cah mov tl0,#0abh mov p1, a rl a reti

main: mov p1, #0ffh mov a,#11101110b mov th0,#0cah mov tl0,#0abh mov tmod,#00000001b mov ie,#10000010b mov tcon,#00010000b

wait: ajmp wait end ____________________________________________________________

Program 2 works erratic on breadboard with leds at P1

ORG 0 mov sp,#030h ajmp main

ORG 0Bh cjne R0,#0,trip clr tr0

over: ajmp over

trip: clr tf0 clr tr0 dec R0 mov th0, #07fh mov tl0, #0feh mov p1, #00000101b setb tr0

again: jnb tf0, again reti

main: mov a,#00000110b mov R0, #1 mov th0,#07fh mov tl0,#0feh mov tmod,#00000001b mov ie,#10000010b MOV P1, A mov tcon,#00010000b

wait: ajmp wait end

Solderless breadboards come in a variety of qualities, and the adage "you get what you pay for" is very true -- last set I got ran about $8 per board from Digikey for "full-size". I think they were by "BusBoard". They're hit-and-miss if you're grabbing them from say Amazon or Ebay and somewhat generically listed as "for Arduino".

Nothing really jumps out at me in your program (although, admittedly I'm not well-versed in MCS51), and since you say it works as you expect in the simulator; I'd hazard it's something physical, rather than the software.

How is everything being powered? Are you using batteries? A wall-wart?

How secure does everything feel as you plug it in? Does it feel like it'd fall out of the board if you flipped it upside-down?

What *exactly* does "erratic" mean? Do you have to wiggle wires, or touch some part of the board, etc.?

I also fel that breadboards are not 100% reliable. I have a few and try another if one works not as expected.

I use USB power supply used with phones that measures 5.1 volt output.

Erratic means .... I first fit the 89C2051 with the first program to the breadboard with leds+330 ohm to P1.0 P1.1 and P1.2 and make sure the LEDs light in sequence as programmed.

Now I remove that 89C2051 and carefully insert the one with the second program. Ensure none of the other connections are distrubed. The three leds shoud go HHL, HLH but all of them light up on start together and blink in no order and everything freezes.

I really am clueless how to tame this !!!

So wait, it's two different chips? It's possible the issue is as simple as "it's a bad chip".

That is news to me. I had no idea that there could be bad chips. Now I will try with burning the second program on yhe chip that works right with the first program.

I have about 5 pieces of 89c2051 and I checked every one of them by loading the working (first one listed earlier) and 4 of them worked as expected. The 5th one though having all th Atmel logo and details stamped refused to load in my programmer and believe it is a bad chip.

4 of out of 5 is ok.

I have now decided to program step by step, first to do one timer and then add on more stagewise. Hope it will work. I will post the results.

Happens, especially if they're older chips you've had for a while -- same idea as tools or anything else that's "old", where it just picks up chips and dings or rust, etc.

Good luck :)

As I said before I checked the 4 modules in my program one after the other, proving one and the going to the next.

Happy to say that when I burnt the program on one of the good chips it worked as programmed.

Thanks for responding to my query and your suggestions gave me some directions and in the end I was able to get through.

Thanks again

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required