We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
#include<reg51.h> void boud_rate() { SCON = 0x50; TMOD = 0x20; /* timer 1, mode 2, 8-bit reload */ TH1 = 0xFD; /* reload value for 2400 baud */ TR1 = 1; TI = 1; } char serial_receive() { char chr; /* variable to hold the new character */ while (RI != 1) {;} chr = SBUF; RI = 0; return(chr); } void main(void) { boud_rate(); unsigned char rx_data; for(;;) { rx_data = serial_receive(); switch(rx_data) { // case '1': open_door(); case 0067892341 : open_door(); break; // case '9': open_door(); case 0045780034 : open_door(); break; default: dont_open(); } proper_delay(); } }
errors
'rx_data':undefined identifier illigal octal digit
please tell me how to overcum these errors
Here's a cheap alternative:
http://www.saleae.com/logic
from http://www.saleae.com/logic :"A large fraction of practical, real world applications run at less than 10MHz, and Logic is ideal for these" When did you last see an enbedded app running at less than 10MHz? Of course if you were to buy something for the sole purpose of seeing your UART output, the thingy would be OK. when salespeople are pushing new stuff they speak of "less than 33MHz is outmoded", when they peddle slow stuff they speak as above,
Erik
PS I do not know anything that logic (lowercase 'l') is not ideal for.
Depends on the kind of stuff you do with embedded. Most embedded apps I did in the past were only 1MHz using at Atmel chip as it was mainly hobby related stuff. It works fine for most Atmega chips using the AVR. it will work fine for any UART based stuff. Yes, it won't do a lot of high speed apps over 10MHz but at that point, you'd just buy a better scope.
So, if scopes are too expensive in India and he needs something to do basic testing, why wouldn't this be a worthwhile solution for him? Do you have a better suggestion?
there is nothng worse than an instrument that show a false picture.
If you consider yourself 100% qualified to tell when a given instrument show a false picture (e.g. not showing a 5ns Glitch on a strobe) then maybe, just maybe, you will get some use of a "hobby" instrument.
THUS, hooking a 10MHz unit to the UART will show a totally misleading picture if there are reflections on the line og the 100ns type (YES, I have seen that killing transmission)
To work efficiently with electronics you need instruments that show anything that is wide and tall enough to make your circuit react (for most small embedded 2V and 5ns will do)
Understandable but, as you mentioned, it's very likely a logic issue rather than a reflection issue at this point. He needs some way to be able to visualize what's going on. You are right that he's going to need a scope if he wants to pick those things up but he might not actually need that (and if it's a non option, which it sounds like it is, he either needs to find an alternate tool or get better at analyzing logic errors, which it doesn't appear is going to happen at this point either).
From what I see, this is a reasonable option.
Here is another product (i haven't used this one but if I remember correctly, it got pretty good reviews). Their top model goes up to 100MHz but it's significantly more expensive than the Salae one (which I have used and works for logic debugging. I personally have found it to be pretty accurate, but then again, the signals I've worked with have been pretty clean. i don't know much about AC noise in India).
http://www.usbee.com/rx.html
What you say makes sense but at this point, I think he just needs a tool to help him find the issue on his own rather than rely on others to debug it for him. I think these would help him and they're not too expensive.
You must be the only person in the history of humanity who uses an instrument of 100% fidelity.
All instruments show a false picture, some are more false than others. No instrument ever showed, or will show 100% fidelity.
I don't really agree with the statement that microcontroller solutions often requires very fast instruments.
Most microcontrollers have a nice integrated clock oscillator. Either the processor runs from an internal RC oscillator, or it makes use of an external crystal and then potentially steps up the frequency internally.
But few people here have issues that the oscillator doesn't run as expected. And most microcontrollers used by beginners have all memory internally, so no fast address, data or control signals.
What then remains are JTAG interface, GPIO and peripherial-specific pins. The UART is seldom run at very high speeds. The microcontroller is often master for SPI communication, allowing the SPI speed to be reduced if needing to look at the signals. I2C don't need high speeds. ADC is an input peripherial where the majority of testing can be done at way less than the maximum bandwidth of the ADC. JTAG can be tested at a lower speed.
So even very cheap USB-connected oscilloscopes with just 1MHz bandwidth and a few Msamples/second can solve most issues people have with their microcontroller designs. It really is very seldom that there are ringing etc on signals that are the big issue, so it really is very seldom people do need really good gear to look at actual signal shapes.
All instruments show a false picture, some are more false than others. No instrument ever showed, or will show 100% fidelity. sure, 100% is not reachable, I atually had an experience in the old TTL/455 days when the only scope that worked for a given glitch was the "DNA scope" We had to reason out way to where and what the glich was. HOWEVER, the more you see, the better off you are and buying something that is LIKELY to be "infidel" is not a good idea.
"All instruments show a false picture ..."
What you meant to say was: All instruments show a true picture of something that may be a misrepresentation.