Description:
 This project describes a basic pocsag encoder system utilizing a microchip 
16C84 micro controller. The system is specifically designed to encode multiple 
pre-programmed numeric messages to pocsag compatible pagers. An external 
rf-transmitter section is required for this function, and that rf section 
is deliberately omitted from this documentation (you are on your own). 

Disclaimer: 
 This source code is provided on an 'as is' basis for educational purposes only. 
No guarantee is provide or implied for any implementation or purpose. I do not 
assume any liability for any business loss, property loss, personal loss,
personal injury, or any other kind of loss (I don't want to hear about your dog).
Use at your own risk!  
And specifically do not use for any life support or other safety related purpose. 
SO THERE! 

Copyright:
  Poc_code.asm is copyright Henry Carl Ott (that's me). You are free to use it in 
non-commercial applications. Any commercial or for profit use requires specific 
permission from me.

Credits:
 Basically the inspiration for the project came from the rx pager design by Dejan Kaljevic.
His code does pocsag decoding. If you want to learn about pocsag decoding, take a look at:
http://www.geocities.com/SiliconValley/Horizon/6063/) 
 Unfortunately pocsag encoding requires an entirely different approach so I had do 
just about everything from scratch. Most of the subroutines are modified microchip app notes,
but I also got a lot of great tips and ideas from the pic microcontroller discussion list.
Too many to mention individually, a really great bunch of guys.
Look to: http://www.myke.com/piclist/ for a good faq and subscribe instructions for the list.
All of the truly awful code in the design is mine alone. 		

NOTE:
If you need to know the specifics of the pocsag protocol, this is not the place. I suggest 
you do some additional searching on the web.


Operation:
 The source code is written to assemble under MPLAB, it may require minor modification 
to assemble properly in other design environments.

  The hardware consists only of the pic, a 3.6864 crystal, and the rs-232 interface.	
  See the included schematic for pin assignments.

 The program has two basic modes of operation.
 1. The stand alone encode mode. When you press a button a pocsag message is generated.
 2. The program mode. While connected to a dumb terminal the cap code and other pager specific
information is pre programmed in to 16c84's eeprom. The buttons do nothing.


 Programming:
 The 16c84 has 64 bytes of eeprom. This memory is used to store 4 paging 'profiles'.
Each profile contains all the information to generate a single pager message. 
The profile contains: the pager cap code (or pin), the message function (0,1,2,3),
the message baud rate (512,1200,2400), a flag to determine if the output data should
be inverted, and an optional numeric message (at the moment 5 digits max). 
 
So here we go:
Hook up the completed unit to any rs-232 terminal (or program) configured 9600 8N1.
Hit any key and you should get  a '.' prompt.
At this point you can hit 'x' (case does count) to exit back into the encode mode,
or hit 'p' to program a specific profile. If you don't hit anything the program will 
exit back into the encode mode on it's own after about 20 seconds.		   

If you are in the program mode you will be asked to enter the profile data.
PROFILE=    ; select a specific pager profile to update 0 - 3 (no error checking here)
CAP=        ; a valid 7 digit decimal cap code (no error checking)
FUNC=       ; the page function bits 0-3
BAUD=       ; the baud rate to transmit 0=512 1=1200 2=2400
INV=        ; 0=normal output data, 1= inverted output data
MSG? Y/N    ; if this profile contains a numeric message. If no, a tone only page will be generated.
 	    ; if yes, you will be prompted to enter a 5 digit message. spaces and '-' are supported.

If you make a mistake or wish to cancel hit a non valid key and you will get another '.'
prompt and will have to start over. NOTE that if you screw up in the middle of a profile, that
whole profile will me marked invalid. But the other profiles will be left untouched.


You can configure four completely different profiles to activate 4 different pagers, or send four
different messages to the same pager.


 Encoding:
 After you exit the programming mode, or if you are in the default mode at power up, pressing one of 
the buttons will generate a pocsag message for the profile that is associated with that button.
 The PTT line is  asserted to key up a connected rf transmitter.
 after a .25 second delay (approx) the encoded batch data is shipped out the poc_data pin.
 The PTT line is de asserted		

 Note that in this prototype no input conditioning is attempted (debounce). The intent is that you 
can re-write the main routine to handle any sort of input device.	 	
 	


That's all folks. There's plenty of room for improvement, if you add on any gee wiz functions
or find any bugs please be sure to drop me a line.

Have fun, and if you have any questions send me some mail at: carlott@interport.net


 


