[aprssig] Need some advice : Generating packet on a PIC

Scott Miller scott at opentrac.org
Thu Jan 13 17:16:05 EST 2005


Hi Andrew,

I'm trying to make my notes (http://n1vg.net/packet/index.php) detailed
enough to cover all of this - if there's something you'd like to see added,
let me know.

The FCS isn't so bad.  You can do it a bit at a time, or a byte at a time.
Most of the examples you'll find will be the byte-at-a time type.  To do it
a bit at a time, start with a 16 bit FCS variable. Set it to 0xFFFF before
you start sending. Each time you send a data bit, check the low bit of the
FCS and shift it right one bit.  Not sure what the procedure is in PIC
assembly, but for the HC08 you'd use a CLC and ROR to clear the carry bit
and rotate right.  That does the shift and gets the bit you're after into
the carry bit so you can test it.  If that bit is NOT the same as the data
bit you're sending, exclusive-or the FCS with 0x8408.  When you're all done
sending data, take the complement (XOR with 0xFFFF) and send it low-byte
first.

You're right about the bit stuffing.  Just remember that stuffed bits don't
affect the FCS, and that the FCS calculation is performed on the actual data
bits, not the NRZI encoded versions.  Oh, and don't forget about the NRZI
bit.  It's NOT "1 = 1200 hz, 0 = 2200 hz."  It's "1 = no change in tone, 0 =
change in tone".  Lots of bad or misleading information out there.  And make
sure your tones are phase-continuous - you can't be jumping back to zero
when you switch tones.

I use Yoshimasa Electronic's Realtime Analyzer program for doing analysis of
the audio.  Works well enough that I paid a few bucks for a registered
version.  It's at www.ymec.com.  Debugging waveforms is never fun, but that
helps - for low frequency stuff, it's easier than my HP digital storage
oscilloscope.  And the 'scope is busy at the moment debugging a 1KV
switching power supply - something I wouldn't want to do with a sound card.
=]

Scott
N1VG

> On Thu, 13 Jan 2005 19:48:04 +1000
> "Andrew Rich" <vk4tec at tech-software.net> wrote:
>
> > Howdy,
> >
> > I have just completed some PIC code that uses a R ladder to create RTTY
> > tones.
> >
> > This works a treat with 100% copy even over a noisy, radio link.
> >
> > Problem. Not much uses RTTY except some stand alone programs, nothing
> really
> > "APRS"
> >
> > I have therefore made the decision to go for ax25 packet.
> >
> > What should I arm myself with as far as documentation ?
> >
> > 1. Scott N1VG's notes on ax25
> > 2. dcc.doc by w2fs "Genarting ax25 ui frames with Pic microcontrollers"
> >
> > I see the greatest challenge will be the FCS
> >
> > I understand that apart from the flag, you have to bit stuff after 5
> > consecutives bits.
> >
> > Any help appreciated.
> >
> > I have acheived so much with PICS, and if I can interface with my TNC I
> > would be most happy
> >
> > Cheers Andy VK4TEC
> >
> > www.tech-software.net





More information about the aprssig mailing list