Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : uMiteII com input #1 fails
Author | Message | ||||
redrok Senior Member Joined: 15/09/2014 Location: United StatesPosts: 209 |
I'm having trouble reading a string from an FE5680A rubidium frequency standard. Here is a test code sample! I'm running a 28 pin uMiteII v5.1 on a plugboard. COMSPEC$ = "COM1: 9600"
The problem is that after sending the query it takes from 100mS to 400mS for the response from the FE5680A.
S$="" OPEN COMSPEC$ AS #1 PRINT #1, "S";CHR$(13); ' Output "S" + c/r ' The string returns after 100mS to 400mS ' It has 38 ASCII characters + c/r INPUT #1, S$ ' <-- It hangs here PRINT LEN(S$),S$ CLOSE #1 END I have tried everything I can think of to capture the string. Including testing EOF(#1) in a DO WHILE loop before doing the INPUT #1, and other things. I know the string is there as my XScope sniffer and Oscilloscope shows both the query and response. But the uMiteII doesn't see a thing. I suspect the INPUT #1,S$ is timing out before the string gets there. Any suggestions on what to do? redrok |
||||
JohnS Guru Joined: 18/11/2011 Location: United KingdomPosts: 3678 |
Does the 'mite want CR LF but is only seeing CR? Maybe use the INPUT$() function? John |
||||
redrok Senior Member Joined: 15/09/2014 Location: United StatesPosts: 209 |
I don't know about the LF requirement. The FE5680A doesn't send it. I do know the EOF() shows the buffer is always empty though. Did the INPUT$() to no avail. Also inputting 1 character at a time. However the EOF() still shows the buffer is empty. I should add: I have an RS-232 inverter using a pair of MOSFETs to buffer the true RS-232 on the FE5680A. redrok |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 5923 |
Using the code you supplied, you might need a PAUSE 400 delay before reading the response. I prefer to check for data then read whatever is there and add it onto a buffer$ That way you should see something even if the data is inverted or no line-ending. But I don't think that is the main problem. Can you check the input at the 'mite pin to be sure that the inverter is working? Jim VK7JH MMedit MMBasic Help |
||||
Grogster Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9083 |
Try adding this instead of your INPUT command: Do:LOOP until LOC(#1)<>0 <-- MM will wait till there is data in the buffer S$=INPUT$(LOC(#1),#1) <-- Suck everything out of the serial port buffer What is PROBABLY happening, is that you are asking the MM for data from the serial port WAY before it has any chance of arriving from the FE5680A, so all you get is nothing - cos there is no data there to suck out of the serial port buffer, at the point when you execute the INPUT$ command. The loop above will wait till there is something in the buffer BEFORE it tries to suck that data out with the INPUT$ command. You can change the '<>=0' bit to something else, so that if you expect 10 bytes, you could change the line to Loop until LOC(#1)>=10 and the MM will wait till there is at least ten bytes(or more) in the buffer before it sucks them out via the INPUT$ command - that kind of thing. Serial port buffers are great things once you get your head around using them! Smoke makes things work. When the smoke gets out, it stops! |
||||
redrok Senior Member Joined: 15/09/2014 Location: United StatesPosts: 209 |
Ok guys, everything works fine now. What happened was I find the uMite pin is making an intermittent contact on the plugboard. The weird thing is when I touched the pin with the scope probe it made contact, but apparently without the probe it didn't. Go figure. The fix is to bend a small wire in a U and put in 2 adjacent hole then put the chip back in and everything is good. I then tested all the various methods and they all worked. This is particularly elegant. Thanks guys for the help. What I am doing is driving 2 or more serial devices with a single COM port. The several devices are selected with diode OR switching. redrok |
||||
Grogster Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9083 |
Flippin' breadboards! They seem to cause a few obscure bugs like this. Glad it is working for you. Smoke makes things work. When the smoke gets out, it stops! |
||||
bigmik Guru Joined: 20/06/2011 Location: AustraliaPosts: 2870 |
Griggs, All, I agree, these breadboards, well at least the Cheap Chinese crap I bought are so bad that they are near useless... I think I need to invest in a high quality unit if I was to use these to any great extent.. Personally with pcbs being so cheap to get done these days it is almost as easy to do a design and test it on the pcb directly.. Regards, Mick Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<< |
||||
viscomjim Guru Joined: 08/01/2014 Location: United StatesPosts: 925 |
BigMik, I have fallen into that trap, if you want to call it that. Any project that gets a bit to unruley for a breadboard, I seem to be addicted to just going to Dex and sending a board out (or 10) to shenzhen2u and getting a board back. So cheap and as long as you triple check your schematic and layout, it just seems to be a bit easier to go this rout. <<< get it??? (an unintentional pun). Now I try to add extra capabilities to each board, just in case I could use it for other projects, so they start to become somewhat "universal" for certain things, ie, if I have the spare pins, I will add a tsop4838 pinout or just put available headers for unused pins, just incase I could use them later for something else. Once again, I blame Geoff and TBS for all of this... (happily). |
||||
Grogster Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9083 |
I also prototype via PCB's now. Every now and again, I might want to actually test something on the breadboard, but for the most part, I just do as you guys do, and layout the PCB, triple-check as much as possible for any silly mistake, then build and develop the prototype right on the PCB as they are indeed so cheap. Usually my 1A version needs some kind of PCB hacking to fix something, but that done and proven to fix the problem, the 1B's are ordered and are usually correct then. This would be a different story if the PCB's were more expensive to get made, but...... Smoke makes things work. When the smoke gets out, it stops! |
||||
viscomjim Guru Joined: 08/01/2014 Location: United StatesPosts: 925 |
Grogs, I agree with versions going from A to B. I HATE THAT, so now I sleep on every board before sending and always seem to find mistake the next day, then send it out. If it weren't for Shenzhen2U or ITEAD studios and the like, I would never have even learned to layout pcbs. I could never have afforded it based on most U.S. pcb houses. For what I pay to S2U compared to most of the U.S. based houses, it really is feasible. |
||||
Grogster Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9083 |
Indeed. We have a good quality PCB house here in New Zealand, but their prices are about ten times the price for the same board from SH2U. I won't mention their name, as I don't want to come across like I am slandering them or anything. Their boards are excellent, and I guess the price is simply what they have to charge here, in order to survive as a company in this economy. I often sleep on the design for several days once I have got it to the point where I think it is ready, and even though this allows me to catch a couple of changes(as you say), I find I still make mistakes. Can't be helped with the 1A's I guess - they are the alpha design. Case in point: The RFID PCB I ordered recently. It was only after I sent it off and it was in production, that I realised you CAN'T use the unused SPI-IN(pin14 of 28-pin chip) once you have opened the port to the LCD. This would seem obvious, really, but I did not think of that.... So the LCD-backlight switch on pin14 now cannot be used, as as I have a full ship's compliment....(all other pins are in use) It's no big deal really, as the 1,8" LCD only uses 10mA or so of backlight current, and in it's use as access control, it will be powered all the time anyway, so no need to save current by turning off the backlight, really. But yeah, this board is now a 1B before I have even build the 1A!!! I just won't populate the backlight control components, and wire the backlight permanently to Vcc via a resistor for the purposes of the 1A board. Whoops...... I seem to have digressed a little from the original topic - sorry. Smoke makes things work. When the smoke gets out, it stops! |
||||
robert.rozee Guru Joined: 31/12/2012 Location: New ZealandPosts: 2294 |
just be aware that backlighting, even LED, has a finite lifespan. as i recall, numbers like 50,000 hours MTBF are not uncommon. running 24-hours a day, this translates to around 6 years. make sure this is suitably past the expected lifespan of your product. is there no way geoff can change the firmware so that the unused pin is deallocated from the SPI IN function? or you could use the SPI clock to trigger an LM555 monostable that controls the backlighting - so that every write to the LCD caused the backlighting to come on and stay lit for the period of the monostable. regarding the cheap breadboards, i've had quite the opposite experience to what others have found. a pile of 10 cheap solderless breadboards from china have all worked without issue, along with smaller numbers of other breadboards that have arrived from all sorts of sources over the years. but then i have always observed certain precautions, in particular you MUST clean all trace of adhesive off the ends of component leads that were supplied in any tape form. also worthy of mention is that wonderful invention - veroboard. the last lot i brought from jaycar cost something like $12 for a piece 100mm x 300mm. this has lasted me a couple of years and there is still a good chunk left. when using veroboard an essential tool is a small drill bit (5mm or therabouts) permanently mounted into a handle, which is used to break traces where required. cheers, rob :-) |
||||
Grogster Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9083 |
Yeah, those are a couple of options. Might look into those. I'm using a 330R resistor for the backlight, and the backlight current is therfore only 3mA for the entire backlight, yet this still makes the display perfectly visable. Not sure if that has any bearing on the MTBF, but at 3mA, one would hope so, as the LED's are far from being stressed at that current. False logic? Smoke makes things work. When the smoke gets out, it stops! |
||||
robert.rozee Guru Joined: 31/12/2012 Location: New ZealandPosts: 2294 |
you'd need to look closely at any datasheets for the display and/or backlight LEDs. if neither are available or helpful, a datasheet for similar LEDs may provide some clues about current derating to extend service life. thinking it over, the LM555 monostable idea could be applied to the LCD's CS line instead, which may work better. cheers, rob :-) |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 5923 |
I was in a local Dick Smith a few years ago when they were getting out of components. I grabbed a pile of veroboard at very good prices. I now regret giving so much away. Much better than the sea of holes stuff. Jim VK7JH MMedit MMBasic Help |
||||
Print this page |