PDA

View Full Version : Generate AX. 25 Modem signals with a PIC.



Pic Toy
- 2nd January 2008, 19:03
Hi All,

Can you please help me to generate AX 25 protocol with a PIC.

How do you generate the 1200 Hz and 2200 Hz frequencies and the data out on a port with R2R ladder on 4 bits?

I am busy building a Packet Radio modem for HAM use. Packet Radio / APRS Transmissions.

I am a licenced Radio HAM and use PBP.

Thanks my Friends

Pic Toy

skimask
- 2nd January 2008, 19:42
Hi All,
Can you please help me to generate AX 25 protocol with a PIC.
How do you generate the 1200 Hz and 2200 Hz frequencies and the data out on a port with R2R ladder on 4 bits?
I am busy building a Packet Radio modem for HAM use. Packet Radio / APRS Transmissions.
I am a licenced Radio HAM and use PBP.
Thanks my Friends
Pic Toy

FREQOUT...it's all in the manual...but then that's only a one-bit output. Put a filter on the output that's good enough and you shouldn't need a 4 bit ladder...

(Yep...I said it...the manual...unless of course you don't have a manual...)

Pic Toy
- 2nd January 2008, 20:00
Hi Skimask,

Thanks for your reply. I have used Freqout in the past to create tones with the simple filter , but how do I convert serial data into an audio signal, D-A conversion? not sure what and how to send it to 4 bits on eg. PortB.0 to PortB.3 with R2R D-A?

I bought PBP many years back from MeLabs and updates from local distributor.

BR
Pic Toy

skimask
- 2nd January 2008, 20:13
Hi Skimask,

Thanks for your reply. I have used Freqout in the past to create tones with the simple filter , but how do I convert serial data into an audio signal, D-A conversion? not sure what and how to send it to 4 bits on eg. PortB.0 to PortB.3 with R2R D-A?

I bought PBP many years back from MeLabs and updates from local distributor.

BR
Pic Toy

XR2206?

I just looked at the spec's for AX.25...
Good luck with that...

Pic Toy
- 2nd January 2008, 20:18
Yes I can use the XR2206 or even the FX604 or FX614, guys are doing it all with one single 16F84 and 16F628.

BR
Pic Toy

skimask
- 2nd January 2008, 20:35
Yes I can use the XR2206 or even the FX604 or FX614, guys are doing it all with one single 16F84 and 16F628.

BR
Pic Toy

So what you're saying is...(gotta see if I'm getting this right or not)...

A serial line input....regular ol' RS232 type serial data type stuff...

4 bit ladder output....Port D0-D3 for example...

Serial input is low, output on 4 bit ladder is effectively a 'sine' wave at 1200hz...
Serial input is high, output on 4 bit ladder is a 'sine' wave at 2200hz?

Standard ol' Bell202 (was it the 202?) modem type stuff yes?

skimask
- 3rd January 2008, 04:15
So what you're saying is...

So I did a bit of thinking...and this might be the hard way to go about it...if my earlier post was correct in the way I was thinking about the issue at hand......

Build up 2 tables, one table contains values for a 4 bit sine wave at 1200 hz, one table contains value for a 4 bit sine wave at 2200 hz. Should be easy enough in Excel or whatever. And these tables only have to be long enough to produce a complete sine wave (or a half or a quarter sine wave, depending on how math savvy you are).

Sounds simple enough...But these tables would have to be synchronized to produce those frequencies at a known sample rate, in this case, 19531.25hz, which just happens to be 20Mhz (oscillator) / 4 (instruction rate) / 256 ( timer 0 overflow interrupt). I.E. 16.276 samples would be one complete sine wave at 1200hz, 8.8778 samples for one complete sine wave at 2200hz. So you can see that you'd need a table long enough to get something where the table would end at a nice 'stopping point' for each sine wave before starting over again.

On each Timer 0 overflow interrupt...
-If the serial input line is low, you step thru table 1 (1200hz) lookup values and output those on your R2R ladder port bits...
-If the serial input line is high, you step thru table 2 (2200 hz) lookup values and output those on your R2R ladder port bits...

One problem I see is the transition between the 2 frequencies when the serial input line changes. You could possibly go from the top of one phase of one freq to the bottom of another phase of the other freq...thereby generating crazy harmonics that the detectors at the other end might not like, or then again, they may not care and filter them out (likely the case).

I suppose if you had a good enough filter on the PIC pin output, you could just shift out 1's and 0's to approximate the freq's, or just use the FREQOUT command in a really tight loop. Maybe define'ing the OSC to a different value than what you're actually using to get faster ONMS times and changing the frequency depending on the ratio of Fosc vs. what you're actually running the PIC at. For example...
DEFINE OSC 4 (while running the PIC at 4Mhz)
FREQOUT pin, 1, 1200 would give you 1ms of 1200hz

but...
DEFINE OSC 4 (while actually running the PIC at 20Mhz)
FREQOUT pin, 1, 6000 would actually give you .2ms of 1200hz
This way you could sample the serial line every .2ms (or just a hair over that). As long as you weren't running over 4800 baud, this method MIGHT work.

I doubt it, but it's an idea I had running thru my head...

Pic Toy
- 3rd January 2008, 04:37
Thanks Skimask for the explanation !!

I need some guidence my friend like sample code. I never did it this way.

I will receive GPS info serial in on a pin and have to send it out "voice" (AX.25 Protocol) into a radio's mic.

BR
P T

skimask
- 3rd January 2008, 13:31
Thanks Skimask for the explanation !!
I need some guidence my friend like sample code. I never did it this way.
I will receive GPS info serial in on a pin and have to send it out "voice" (AX.25 Protocol) into a radio's mic.
BR
P T

Better idea...You write some code...and if it doesn't work, I'm sure a dozen people will help you troubleshoot it, 'cause here's my example code...

main:
if serial_pin = 1 then
freqout 1,1,2200
else
freqout 1,1,1200
endif
goto main