8085 Real Time Clock Help.
I am Not in school. But I would still like help. I built my 8085 on my proto board.
I know it works. I can program it ok. But I have been playing with a real time clock.
My problem is I can't figure out how to make it use the buttons on my 8155 chip to add a min or add a hour. I can us the buttons for other things. Like I said I can use all of my computer. All my ports work fine. I just dont know the code. Right now I have the time on a small Dl1414 display. Its in binary. So the screen is wrong. but I think I can convert it to ascii. I found some code for that. But how do I tell it to look at the button and the to look at the min or hour and then add one and then program it back to the realtime clock chip. I can program any staring time I want in the bigging of my code. But what good is that. LOL.
Yes I would love some on to write my code for me. I know you say its not going to teach me. But for me I will break down what you wrote and figure it out.
My computer info
8155 Control port 80H, port A 81H, port B 82H, port C 83H, timer Lsb 84H, Msb 85H
My buttons are pulled low on port A Pa0 Pa1 Pulled high when button pushed.
Real Time 12c887 Starts at 00H
Display Ascii. Thou F0H, HUND E0H, TEN D0H, UNIT C0H
Re: 8085 Real Time Clock Help.
It was about a year ago. That I started working with the 8085 cpu. I knew nothing and I had lots of questions. I found almost no one to help me. So I bought a book and started reading. I then got a nice proto board and the parts hooked up. I started with what I always do first. I make a LED flash. If I can do that then I have some kind of control. It took me all year to get to what I can do now. You can find my YouTube videos by searching for FIGTRONIX. I want to give some help to someone out their who would just give up because it is so hard. I had questions like where do I even start my code at. Or how do I keep it going. You have to build your circuit first. Anyone can build a computer. But your computer might have a certin display at I/O port 00h and I have mine at 80H. You might have seen older 8085 computers like the Radio Shack TRS80 Model 100 boasting that it has 256 I/O ports. The 8085 cpu will use the lower 8 address (A0-A7) lines for I/O device' it will mirror the port selected on the upper address lines (A8-A15). So if you know how many address lines are available the formula is 2^x (x=address lines) 2^8=256.
It is a eight digit binary number of 1's or 0's. 00000000 = 00H - 11111111 = 256. So what! Right. What does that even mean. Well I found out it does not mean that you will have 256 different devices that the cpu can use. You can but you wont use it like that. Lets look at ROM and RAM real quick. The I/O only has the lower eight address lines. But the 8085 has 16 address lines 2^16=65,536. WOW I can put a 64k Ram in my 8085 right. Not really. You can transfer control and make two rams work but not us for now. We will Have one Rom and One Ram. The Rom will take address space from 0000h to 7fffh and the ram will work from 8000h to ffffh. If you find a Hex to Bin calculator on the internet. You can put in the high numbers of the Rom,Ram and see that 7fff=32,768 and ffff=65,536. We split the Address space in half. Lower 32kb for Rom and upper 32kb for Ram. You do this with a decoder circuit for Ram/Rom. A decoder circuit will "DECODE" the address lines inputed to a single output at a time. A decoder chip like a 74ls183, a 3 to 8 decoder. Will take 3 address lines in and give you 8 possiable outputs. 2^3=8. so if the address lines you pick for inputs are A0,A1,A2. Then your eight outputs would have the following address space.
So. If you have this 74ls138 hooked up as your I/O decoder. And you hooked two LED displays up one with CS (chip select) for each. Lets pick 0 and 1. So the first LED will be active from 00h to 1Fh or 32 I/O address locations. The seconed from 20h to 3Fh or 32 I/O address locations. Here we have wasted I/O address space because the most LED display don't need but one to enable it and eight bit binary data to set the output. So we wasted 31 I/O locations. But If you use a 4 to 16 decoder you drop down to 16 I/O location per I/O address location. But now you have 16 I/O CS'. But beware. Some chips like the 8155 or the different real time clock chips need more Than 16 I/O locations. Look at the datasheets. Now more Ram Rom. You can use memory mapped I/O. But I like the full Rom and Ram. So We will use a dual 2 to 4 decoder and a 7408 AND gate for the Rom Ram Cs'. The 2 to 4 decoder will be hooked up to A14-A15. The decoder has four outputs. But we have Two chips. Thats the 7408 AND gates job to take 2 in and give one out for Rom and the other two in and give one out for Ram. You will need the book in my videos or some kind of circuit to help you but I hope You understand some of the Hardware better.
Now Software. You need to have your Reset circuit right to cause one reset on first power on. If you don't the cpu will start reading anywhere. It takes a reset to start the Program counter at 0000H. You write your code starting at 0000h. The first line should be a jump off of the first page. Because the first page is where interrupt requests jump to. So jump down a page or two. If your program will Call (GOSUB) anything you need to next set the Stack Pointer. Set it to the highest Memory address space you have FFFFh. The stack will save data starting at FFFFh and work down. Start by hooking up a circuit. Then work on the flashing light.
You Dont need a Stack and you can stay on the first page because you have no interrupts. You want to turn the light on pause turn it off pause the restart.
MVI A 3E 01 LOAD ON TOP:
OUT D3 00 TURN ON
LXI B 01 FF TIMER
DCR B 0B LOOP1:
MOV A,C 79
ORA B B0
JNZ C2 LOOP1:
MVI A 3E 00 LOAD OFF
OUT D3 00 TURN OFF
LXI B 01 FF TIMER
DCR B OB LOOP2:
MOV A,C 79
ORA B B0
JNZ C2 LOOP2:
JMP C3 TOP: START OVER.
NEVER GIVE UP!!!!
Adam Blaire Figueroa
|All times are GMT +5.5. The time now is 11:26.|