Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/10/05 13:46
Read: times


 
#99113 - using the COUNTER with the SERIAL
Hi

I am using Assembly code.

I am trying to get the counter on the 8051 to count external input signal pulses from two shaft ENCODERS. After recieving the number of revolutions done by the encoder, I would like this number to be sent back to the PC displaying something like "NUMBER OF REVOLUTIONS =100" for say one minute.

I know that I have to use P3.4 and P3.5 and attach the encoders to these pins.

The problem is when writing the code, I have to configure the serial connection as well as the counter/timer, and it does seem simple but I'm not 100% sure what the code should look like.

Also when initialisng the serial i was going to use:

START: MOV SCON,#00010000 ;MODE 0, RECIEEVR ENABLE (REN)
MOV PCON,#0 ;SMOD goes to 0
MOV TH1,#-3 ;9600 BAUD RATE

Does thsi seem correct?

Also if i was going to use a counter, wouldn't I need to also initialise TH1? if i do then how can I use the TH1 SFR for both the serial and the counter?

I really need some help in writing this code.

It should be quite simple, because it just involves counting some pulses using a sensor and then sending this information back to the PC, so that i can visually see the number of counts that the sensor has counted.

please help if you can

thank you

List of 25 messages in thread
TopicAuthorDate
using the COUNTER with the SERIAL            01/01/70 00:00      
   I think your problem is that you are usi            01/01/70 00:00      
      chip being used            01/01/70 00:00      
         give a link            01/01/70 00:00      
   wahts about the direction ?            01/01/70 00:00      
      To Peter            01/01/70 00:00      
         Change chip.            01/01/70 00:00      
            Nope! I can't do that            01/01/70 00:00      
               I do not know if micro can, but it would            01/01/70 00:00      
                  sorry            01/01/70 00:00      
                     How do you propose to (re)program this c            01/01/70 00:00      
         use external interrupts            01/01/70 00:00      
   DEEPEST APOLOGIES!!!            01/01/70 00:00      
      Re DS5000            01/01/70 00:00      
      ds5000            01/01/70 00:00      
   Created a program!            01/01/70 00:00      
      read up on UART modes in "the bible"            01/01/70 00:00      
   A new idea! maybe the right one            01/01/70 00:00      
      you are running out of timers            01/01/70 00:00      
   using the COUNTER with the SERIAL port            01/01/70 00:00      
      timer2            01/01/70 00:00      
         No timer 2            01/01/70 00:00      
            Your problem is that you need 3 counter/            01/01/70 00:00      
               erik            01/01/70 00:00      
                  I think you have run into a mental block            01/01/70 00:00      

Back to Subject List