Saturday, 15 November 2014

Bigger Hammer!

I read a couple of things online that made oblique references to inverting signals, then decided I wanted to invert a TTL signal, despite having no inverter chips lying around, so... this code allows an Arduino to emulate an inverter that could be made from a couple of resistors and a transistor:

void setup(){
  pinMode(7,INPUT);
  pinMode(8,OUTPUT);
}

void loop(){
  if(digitalRead(7) == HIGH) digitalWrite(8, LOW);
  else digitalWrite(8,HIGH);
}

which in turn allowed me to successfully read the NMEA data from my antique Standard Horizon CP150C chart plotter. The plotter provides 2 wire connection for the serial NMEA sentences it shares with the world, but for some unknown reason related to RS232 and RS 422 and NMEA, the data is inverted, 5 volts when the listener expects 0 and 0 when the listener expects 5. Suddenly, by magic, I get

$GPGLL,,,,,215457,V*06

instead of

..\%........3g..*.N.Y..L.=..\%........3ge.>>N.Y....=..\%....

and that GLL sentence would have a whole lot more position data between those commas if the antenna could just see a few satellites from here in the workshop.
$GPGLL,4413.734,N,07629.154,W,221318,A*3B
I hope the next person who googles for

CP150C NMEA to RS232 serial

finds this page to answer their question quickly.

No comments:

Post a Comment