Discussion in "Project Addition or Changes" started by    nitheeshas    Jan 3, 2012.
Tue Jan 24 2012, 08:35 pm
#11
its hard to imagine what kind if keyboard you have well you need to increment R0 rather decrement.

Which circuit are you talkin about? the circuit is same what is there in zip.
Wed Jan 25 2012, 08:17 pm
#12
in the circuit, there are 3 capacitors only, but in the picture of your propeller display, there are 4 capacitors..2 plate capacitors(clock), 10uF(reset) and there is an additional one which is not there in the circuit..

and in your program, the memory location is being decremented. thats why i did so.

is it okay if I use a 12mhz crystal or is it advisable to use a 4.9152mhz crystal only? I'm having a 24pu version of 2051 (24mhz speed)


[ Edited Wed Jan 25 2012, 09:39 pm ]
Wed Jan 25 2012, 11:23 pm
#13


Literally, this is my first program, so i expect a lot of errors..
Please help me to figure them out..

nitheeshas


I would advise you to start with simpler projects just to practise the basics
of memory access etc.
You will end up doing lots of simple "tests" anyway.


in the circuit, there are 3 capacitors only, but in the picture of your propeller display, there are 4 capacitors..2 plate capacitors(clock), 10uF(reset) and there is an additional one which is not there in the circuit..

nitheeshas


It is probably part of the power supply.
Including the power supply there are five capacitors.

FYI.. although the project is hosted here, it is not "our" project.
None of the moderators or Ajay had anything to do with creating it.




The address does not decide whether it is ram or rom.
There is a address 0x40 in ram and in rom/flash

ExperimenterUK



so then what determines if its a ram or rom location?

nitheeshas



Addressing is not always obvious, and can confuse even experts.
The micro knows which is which because of the type of instruction.
EG
"cjne a,#ffh,noexit" -------noexit must be rom because jumps are always to rom
mov @r0,"Z" -------r0 always points to ram.


The compiler/assembler uses the code you write to decide.
EG
org 0013h ----- means an address in rom, because you said "org"

"org 230h
lookup:
db 10000010b,01111100b,01111100b,01111100b,10000010b,11111110b
Here 230h is an address in ROM.. "db" means define a byte in rom here. 230h,231h,232h etc

A location in RAM would be
count EQU 0033h--- because you said EQU and you use "count" as if it is ram.




anyways, this is the rough sketch of the code i'm having in mind:

org 0013h
acall input
reti
..
.
input:
loop:
mov r0,#40h ;or other ram address
mov a,p3
anl a,#bbh ;clearing P3.2 & P3.6; P3.2 is being used for ext0 interrupt

zero:
cjne a,#00h,one
mov @r0,"0" ;ascii value of zero
ajmp next

one:
cjne a,#01h,two
mov @r0,"1" ;ascii value of one
ajmp next
..

nitheeshas



Your "input:" code always starts at 40h, so I assume it will just write
a single char to 40h.
Testing for every character code is messy, can't you just input the proper code ?

Where does the input come from ?


and in your program, the memory location is being decremented. thats why i did so.

nitheeshas


You are quite right,it does say dec !
Normally copy routines increment,but they don't have to,
and it works,
so fine


[ Edited Fri Jan 27 2012, 05:13 am ]
Fri Jan 27 2012, 12:23 am
#14
wow..thanks for that detailed reply..
-figured out the capacitor part: Ya its a part of power supply. i think its for maintaining a steady power supply, as a slip ring is being used..

-I saw Ajay's name in the report submitted in this site..so i thought both Ajays are same..

-A doubt about memory addressing part:
cjne a,#88h,here
The above code, when debugging in keil, showed(in disassembly window):
cjne a,#TCON(0x88),here
Using a "#" means its an immediate data, right? then why is it navigating to the TCON register address??

-about the program, yeah there is a mistake in that "input:" code.. Thanks for pointing it out..
Testing for every character is indeed messy. I'm working on changing it. The problem is that i used port3 for that purpose, & in AT89C2051, p3.6 is not available, and p3.2 is being used as external interrupt. So cant use both pins, which makes it difficult to recognize the character by any easy way. Can i use port1 itself for inputting the character, as well as the LED output port?
I just have to stop displaying while the characters are being fetched, right?
If port 1 can be used, it will indeed be easy to recognize the character.


Where does the input come from ?

ExperimenterUK


The general circuit i'm thinking of is in the following way:
Transmitter end:
keyboard(an ordinary matrix keyboard)=>8051=>encoder(HT640)=>RF transmitter(TX433)
Receiving end:
RF receiver(RX433)=>decoder(HT648)=>AT89C2051(main microcontroller)


[ Edited Fri Jan 27 2012, 12:25 am ]
Sat Jan 28 2012, 04:27 am
#15


Using a "#" means its an immediate data, right? then why is it navigating to the TCON register address??

nitheeshas


TCON will be defined as meaning 88h somewhere in the header files.
The assembler may just be suggesting 'TCON' as an alternative way of saying 88h.



AT89C2051, p3.6 is not available, and p3.2 is being used as external interrupt. So cant use both pins, which makes it difficult to recognize the character

nitheeshas


How about transmitting each code as two, 4 bit values ?


[ Edited Sat Jan 28 2012, 04:36 am ]
Sat Jan 28 2012, 08:19 pm
#16


TCON will be defined as meaning 88h somewhere in the header files.

ExperimenterUK


ya, TCON is being defined with address 88h.


The assembler may just be suggesting 'TCON' as an alternative way of saying 88h.

ExperimenterUK


So, there isn't any problem in that part, right?


How about transmitting each code as two, 4 bit values ?

ExperimenterUK



In that case, only 4 pins needed right?! But doesn't that make the programming part a bit difficult? especially while using assembly language? Can you give a very short description for that procedure?

Also, can we use port1 itself(which is currently the output port) for inputting the character? If its possible, we can just transmit 6bits(only 6 bits needed for 26 alphabets using an encoder) at a time, as well as make a very short program, which is not like that "compare & jump loop".

And, a small doubt. How does the microcontroller distinguish between the other functions that can be performed by the same pin? I mean, like pin P3.2, which act as EXT0 interrupt as well as the port pin? Is it just by enabling the EXT0 interrupt in the IE register?

another problem, i just found out that my college doesnt have a 2051 programmer.
After googling, i saw some programmers like Easy Downloader, Blow-it etc. The easy downloader seems working, but it needs another 2051 loaded with their program. They have supplied the program, but still, i need another burner for that..The blow-it doesnt need any such programmed microcontrollers. It uses the LPT(printer port) for connecting with PC. Do you think it would be fine?


[ Edited Sat Jan 28 2012, 08:39 pm ]
Thu Feb 02 2012, 02:06 am
#17

And, a small doubt. How does the microcontroller distinguish between the other functions that can be performed by the same pin? I mean, like pin P3.2, which act as EXT0 interrupt as well as the port pin? Is it just by enabling the EXT0 interrupt in the IE register?

nitheeshas


yes unless you enable the alternate function, port will act like normal GPIO.

another problem, i just found out that my college doesnt have a 2051 programmer.
After googling, i saw some programmers like Easy Downloader, Blow-it etc. The easy downloader seems working, but it needs another 2051 loaded with their program. They have supplied the program, but still, i need another burner for that..The blow-it doesnt need any such programmed microcontrollers. It uses the LPT(printer port) for connecting with PC. Do you think it would be fine?

nitheeshas


easy downloader is good and does work. I have tested it myself. but yes the main issue is to get an initial program burnt on IC.
if possible try to replace 2051 with an ISP programmable IC. so you dont need any special hardware to program it the usual RS232 will do the job. it wont make any difference on hardware except some extra space.
Thu Feb 02 2012, 07:24 pm
#18


if possible try to replace 2051 with an ISP programmable IC.

Ajay Bhargav



How about using the AT89S2051? It supports ISP, right?


so you dont need any special hardware to program it the usual RS232 will do the job.

Ajay Bhargav



How can we program it with just the RS232?
Thu Feb 02 2012, 10:20 pm
#19
AT89S2051 is different. I was actually talkin about P89V51RD2 anyways... you can surely replace C2051 with S2051. The ISP circuit are available online, check here:
http://dybkowski.net/content/en/node/15
http://ikalogic.com/isp.php
Fri Feb 03 2012, 01:58 am
#20



The assembler may just be suggesting 'TCON' as an alternative way of saying 88h.

ExperimenterUK


So, there isn't any problem in that part, right?

nitheeshas


Probably no problem .. but a try a few test to make sure.
Use Proteus to build a test circuit... it saves a *lot* of time.



How about transmitting each code as two, 4 bit values ?

ExperimenterUK



In that case, only 4 pins needed right?! But doesn't that make the programming part a bit difficult? especially while using assembly language? Can you give a very short description for that procedure?

nitheeshas


Creating an 8 bit value would not be difficult
Use a bit/flag/byte to indicate the first or second part of a code.

If flag is 0
The first part is just shifted into the top 4 bits and stored.
set flag to none zero

If flag is none zero
The second part is 'OR'ed with the stored byte to fill in the low 4 bits.
store in the display buffer

set flag to none zero, ready for next pair.

Of course if 6 bits is enough, just send all 6 at once and store directly.



And, a small doubt. How does the microcontroller distinguish between the other functions that can be performed by the same pin? I mean, like pin P3.2, which act as EXT0 interrupt as well as the port pin? Is it just by enabling the EXT0 interrupt in the IE register?

nitheeshas


Interrupts are an "add on".
The port works as usual, but you only see changes if you enable interrupts.
Other pins are more complex.
EG..if you enable the serial port, the TX/RX pins are controlled by the
serial hardware.
Actually I'm assuming that is the case
It may not always be true, but I never never tried to use a pin for two purposes
at once, it is hard enough doing one thing at once




Get Social

Information

Powered by e107 Forum System

Downloads

Comments

Astorne
Tue Apr 16 2024, 08:52 pm
Williamjaf
Tue Apr 16 2024, 12:25 pm
best_yyPa
Tue Apr 16 2024, 09:42 am
ErnestoExpop
Tue Apr 16 2024, 02:57 am
Jamesclepe
Mon Apr 15 2024, 11:10 am
Aliciaelora
Mon Apr 15 2024, 07:59 am
btaletvpcu
Mon Apr 15 2024, 04:36 am
UbvpwcTib
Mon Apr 15 2024, 03:13 am