 |
 |
| View previous topic :: View next topic |
| Author |
Message |
Ttelmah Guest
|
|
Posted: Sat Jul 09, 2005 3:22 am |
|
|
Try moving the variable declarations to the 'main', rather than inside the while. Though what you post is perfectly correct 'C', I remember this as giving problems in the CCS compiler. CCS uses the function 'name' to append to the variable name, to create the label for variables. Doing it inside a code block, might not be wise.
Now something is very odd with what you post as the returned values. If communications are working allright to the PC, and you are sending the values with:
fprintf(PC,"%2X",sn1);
and similar statements for the other variables (as Humberto has posted), then whatever is being sent back by the sensor, the PC should only see hex characters. If you are receiving these garbage characters, then you have a communication problem to the PC....
Re-check the PC communication, preferably with a fairly long message.
You could also try a crude test program, to output a pulse on a pin of a known duration, and time this with a scope (assuming you have one), to verify that the chip really is running at 10Mhz. The odd thing is that your garbage messages, appear to be 15 characters long for each line. Now if the packet is five characters long, and you are sending two hex characters for each digit, the message should be just ten characters long (unless you are perhaps adding spaces). This suggests a major timing error.
There have been problems in the past with the software code giving slightly wrong timings, when operating at fairly high baud rates, and tweaking the selected rate value each way a few percent (try about 5% changes), may fix this if it applies to this compiler.
Best Wishes |
|
 |
weg22
Joined: 08 Jul 2005 Posts: 91
|
|
Posted: Sat Jul 09, 2005 11:13 am |
|
|
I tried your suggestion of 37k and 39k baud rates, but still no progress. I just don't get it. The code I have should work...this is soooo frustrating.
I am sending the decimal value 241 by going to:
http://robert.leblancnet.us/Java/Converter/Converter.html
and copying the ASCII equivalent and pasting it to hyperterminal - I know this is correct b/c I'm getting the expected response back from the sensor.
If I can communicate from the PIC to the PC and vice versa using RS232 commands, is it really possible that my old version of CCS is causing the problem?
Last edited by weg22 on Sat Jul 09, 2005 11:50 am; edited 1 time in total |
|
 |
weg22
Joined: 08 Jul 2005 Posts: 91
|
|
Posted: Sat Jul 09, 2005 11:50 am |
|
|
| The only thing that is suspicious to me is that I am only getting these characters back when the sensor and PIC are running off of independent power supplies (i.e. different grounds). When I power both the PIC and the sensor with one supply (using a 7805, the sensor takes 9V), nothing is displayed in the HT. I'm guessing the getc() command is receiving nothing back...so it freezes there. |
|
 |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sat Jul 09, 2005 12:26 pm |
|
|
When you use separate power supplies, the ground connection
probably comes from the ground wire in the AC power supply cables.
It comes from a big 18AWG green wire, in the cable and inside
the walls of your office.
When you use the common power supply, what if the ground
connection doesn't really exist ? Or, what if the connector is flakey ?,
Or, what if the wires that appear to be good are mostly broken off,
and you've really got only one thin 30AWG wire as your "ground" ?
-----------
Can you post the part number of the IMU that you're using ?
Can you post a link to the exact page on the Microstrain website
for it. And, can you post a link to the data sheet for it ? |
|
 |
weg22
Joined: 08 Jul 2005 Posts: 91
|
|
 |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Jul 10, 2005 12:36 am |
|
|
| Quote: |
When I power both the PIC and the sensor with one supply (using a 7805,
the sensor takes 9V), nothing is displayed in the HT. I'm guessing the
getc() command is receiving nothing back...so it freezes there |
You're running the EMU off +5v from the 7805, and the spec sheet says
it requires 5.2v minimum. You're below their minimum voltage, so that's
likely why it doesn't work.
What cable are you using to connect your PIC board to the IMU ?
Are you using their cable ? It's shown here:
http://www.microstrain.com/pdf/4005-0013b.pdf
I couldn't find any document that describes the IMU hardware interface.
There is apparently no connector pinout drawing, and no detailed specs
on the RS232 interface.
Also, I wonder about what mode the IMU is coming up in, upon power-up.
Is it guaranteed to come up in RS-232 mode, at the baud rate that you're
using ? Is it possible that it's been programmed to come up in some
mode that works with Hyperterminal, but is incompatible with your PIC
program ?
One issue I just thought of is, you said you could talk to the PC's serial
port with your PIC board. But you have two serial ports on your PIC
board. Have you ever connected the 2nd one (the one going to the IMU)
to your PC and proven that it works OK ? That could be the problem.
--------------
If it still doesn't work after this, I think you need to email Microstrain
tech support and ask them for any appnotes they have (whether released
or not) that show how to connect the IMU to a microcontroller. |
|
 |
weg22
Joined: 08 Jul 2005 Posts: 91
|
|
Posted: Sun Jul 10, 2005 9:45 am |
|
|
I'm powering the IMU with 9V and the PIC circuit with the output of the 7805 (5V)
And yes, I have proven that both RS232 circuits work.
Thanks anyway everyone... |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|