0
\$\begingroup\$

So at my university professor gave us following scheme to program this double 7 segment display on the right. At start I tried to simply adress it using P0=(someData) although it didn't work. Then I asked my friend how to do it and he said that during lecture professor said that if you want to make it to work you have to adress left part of display as:

unsigned char xdata left _at_ 0xFE00;

and right part of display as:

unsigned char xdata right _at_ 0xFD00;

The question I'm having is why specifically those adresses make it work for port 0? I tried to use other adresses such as 0xFA00 and 0xFB00 and it didn't work. I've also read specifications, documentations of programming those microcontrollers although I didn't find anything.

Can someone explain why it works like that? It apparently is some trick and I'm reaaally curious.

enter image description here

\$\endgroup\$
0
\$\begingroup\$

Those numbers actually have nothing to do with Port 0. They're actually manipulating the address bits on Port 2 — specifically, P2.0/A8 and P2.1/A9.

These bits are connected to the digit select lines of the display. Obviously, if you want to display something on both digits, you need to time-division multiplex them.

I tried to use other adresses such as 0xFA00 and 0xFB00 and it didn't work.

I can't explain that. It should have worked just as well. Maybe you should show us your code.

\$\endgroup\$
  • \$\begingroup\$ I added my code to the question. Why are those numbers manipulating specifically P2.0/A8 though? I get it that they are connected to the digit select lines but why exactly those adresses? When I change 0xFE00 to for example 0xFA00 and 0xFD00 to 0xFB00 it stops working. \$\endgroup\$ – Michał Apr 11 at 14:10
  • \$\begingroup\$ Alright, I think I figured it out. FE is 1111 1110 in binary so 2.0/A8 will be lightened up. Although I don't quite understand why it light's up. I mean 0xFE00 is an adress right so I'm just writing data into that adress right? Why writing into specific adress + specific value into that adress lights up ports? \$\endgroup\$ – Michał Apr 11 at 14:36
  • 1
    \$\begingroup\$ You need to take a closer look at how XDATA accesses work on the 8051 architecture in general. Ports 0 and 2 get used as a multiplexed address/data bus. The display is taking advantage of the fact that the high-order address bits (A[15:8]) aren't multiplexed with data. \$\endgroup\$ – Dave Tweed Apr 11 at 14:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.