??? 05/01/07 14:48 Modified: 05/01/07 15:03 Read: times |
#138389 - Get a \'scope! Responding to: ???'s previous message |
Bob said:
I think things are moving a might fast to see a discernable pattern, but it lights. Oh, my. I take that to mean that you don't have an oscilloscope. Getting one should be your very next step if you're at all serious about working with these little microcontrollers. If money is a problem, look for a used one on eBay. You should be able to find something halfway decent (a Tektronix 2235, maybe?) for well under $200. In the meantime, you might be able to make some progress without a 'scope by adding some delays to the program I posted so that you CAN see a discernable pattern. As it is now, just the fact that the light comes on doesn't really tell you very much. The program might be turning on the light and then going off into never never land somewhere. Or it might be continuously resetting or something so fast that you can't see it. Or ??? So ... make some sort of a delay routine and use it to slow everything down so you can see the blinking pattern on the LED. Note: Making delays with loops in the program like this is generally a REALLY BAD IDEA. I suggest it here only because it is the simplest way possible and you hereby solemnly swear to throw this program away as soon as it works. The timing of the delay routine will depend on your CPU speed, the code generated by your compiler, the constants SHORT_DELAY and LONG_DELAY, the day of the week, etc., etc., etc. You will probably need to tweak the delays in the program to see a pattern on the LED. If they are too short, the LED will be blinking too fast for you to see. If they are too long, you will get bored before the first blink and think something is wrong. Please don't give up because these experiments seem too simple. Every one that works will build your confidence, and the first one that doesn't has a good chance of uncovering the problem you were having with the serial port in the first place. -- Russ #define GREEN_LED 0x01 // Green LED is on bit 0 of P1 #define SHORT_DELAY 10000 // Tweak these numbers until #define LONG_DELAY 20000 // blinking pattern is visible void delay(int count) { while (--count) { /* Add junk here as needed to make the delays longer */ } } void blip() { // Quickly blip the LED once P1 &= ~GREEN_LED; delay(SHORT_DELAY); P1 |= GREEN_LED; delay(SHORT_DELAY); } main() { while (1) { // Repeat forever blip(); // Blip the LED blip(); // Blip it again delay(LONG_DELAY) // Long delay between blip pairs } // End 'repeat forever' } // End main() |
Topic | Author | Date |
Very stubborn UARTs... | 01/01/70 00:00 | |
Keil gives error on your construct | 01/01/70 00:00 | |
Re: error | 01/01/70 00:00 | |
a guess | 01/01/70 00:00 | |
Re: guess | 01/01/70 00:00 | |
humm humm | 01/01/70 00:00 | |
re: humming | 01/01/70 00:00 | |
PS | 01/01/70 00:00 | |
have you tried the simulator? | 01/01/70 00:00 | |
Re: LED | 01/01/70 00:00 | |
HUH??? | 01/01/70 00:00 | |
again a HLL habit, isn't it... | 01/01/70 00:00 | |
2 possibilities | 01/01/70 00:00 | |
Whoops. | 01/01/70 00:00 | |
Dummy Interupt | 01/01/70 00:00 | |
agreed, I do it like this | 01/01/70 00:00 | |
Niiice | 01/01/70 00:00 | |
you could solve a lot of problems if.... | 01/01/70 00:00 | |
Thanks, but... | 01/01/70 00:00 | |
Back to square one? | 01/01/70 00:00 | |
blinkenlight | 01/01/70 00:00 | |
Get a \'scope! | 01/01/70 00:00 | |
More hints | 01/01/70 00:00 | |
Re: hints | 01/01/70 00:00 | |
I am sure it is published | 01/01/70 00:00 | |
Gah. | 01/01/70 00:00 | |
read the right spec | 01/01/70 00:00 | |
specs | 01/01/70 00:00 | |
Not a spec | 01/01/70 00:00 | |
why not? | 01/01/70 00:00 | |
Proviso | 01/01/70 00:00 | |
just a small remark | 01/01/70 00:00 | |
oh, yes, you can | 01/01/70 00:00 | |
Huzzah! | 01/01/70 00:00 | |
value of KISS | 01/01/70 00:00 | |
I find that hard to beleive! | 01/01/70 00:00 | |
Okay, so | 01/01/70 00:00 | |
I thotoughly agree with you there! | 01/01/70 00:00 | |
Further details | 01/01/70 00:00 | |
You\'re not finished yet | 01/01/70 00:00 | |
Lessons | 01/01/70 00:00 | |
\"does have it all\" is of no good | 01/01/70 00:00 | |
Thanks for the update![]() | 01/01/70 00:00 |