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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/09/07 15:52
Modified:
  12/09/07 16:42

Read: times


 
#148009 - re: running out of subject line ideas :)
Responding to: ???'s previous message
Nima said:
In reference to the two questions, when I said 'it worked', I meant loading the value of #080h progressed to load toff with #080h

How do you know this? Are you running it in a simulator, or using some kind of debugger, or what?

when I said it just wont work, I meant sending the value of, say #0FEh I would expect the ontime to be 254/255 of the time. But it just isnt.

What is the ontime, then, and how do you know what it is? Are you looking at it with an oscilloscope?

I've read further on the topics you pointed out and realised

a) I have not been clearing the carry bit at the right time

Excellent.

b) I needed to protect to acc and psw

Also excellent.

- I am not protecting R1 (aka ton) as it is meant to change to the value I am sending over the serial port. Is this wrong?

No, that is correct. If you want the interrupt handler to change something, then you don't protect it.

Finally, and this may seem quite dumb, but if I send #0fAh to the serial port does it take in each character one at a time and essentially load R1 with h each time?

Yes. Sorry. I thought you understood that when I read your answer here. The serial port sees the characters one at a time and loads each one into R1 when the interrupt occurs. So, as you say, if you send the 5-character string "#0fAh", the value of R1 in the end will be the ASCII code for 'h', which is 104 in decimal or 68 in hex. If you send the 4-character string "Nima", the value of R1 in the end will be the ASCII code for 'a', which is 97 in decimal or 61 in hex.

So, suppose you want the value of R1 to be 37 (decimal). To do that, you'd look in your table of ASCII codes, see that '%' is the character with that ASCII code, and send the single character '%'.

Okay, now what if you want a value for R1 that's above 127 (decimal), where the ASCII codes are not so standard any more? I don't know the answer to this, other than to figure out how to make your particular terminal send the codes you want.

Russ, I can't begin to thank you enough for this help.

You're welcome. It's a pleasure becuase it's clear that you're willing to read and study and try to figure things out for yourself. Quite often guys on this forum will show up and expect things to be handed to them in working form with no evidence that they have given a minute's effort. As you can imagine, that just gets tiresome.

-- Russ


List of 22 messages in thread
TopicAuthorDate
PWM code thoughts and help?            01/01/70 00:00      
   Some thoughts and help            01/01/70 00:00      
      very good help Russ            01/01/70 00:00      
      cheers!            01/01/70 00:00      
      character for 32            01/01/70 00:00      
         Good            01/01/70 00:00      
      A & R4 fatal occurence            01/01/70 00:00      
         Info on interrupts            01/01/70 00:00      
            Right next to me...            01/01/70 00:00      
               Aha            01/01/70 00:00      
      tell the truth!            01/01/70 00:00      
         Take a few deep breaths            01/01/70 00:00      
            no arteries popping            01/01/70 00:00      
   hows this? :)            01/01/70 00:00      
      Better, but still has problems            01/01/70 00:00      
         running out of subject line ideas            01/01/70 00:00      
            re: running out of subject line ideas :)            01/01/70 00:00      
            Some comments            01/01/70 00:00      
   Interrupts and shared resources            01/01/70 00:00      
   a thought - if it is help is up to you            01/01/70 00:00      
   More on the PWM program            01/01/70 00:00      
      Purpose of my question            01/01/70 00:00      

Back to Subject List