WSPR : "ko7mWSPREncode"
This declares a byte array to hold the encoded WSPR symbol set and includes the WSPR encoder in your code. You would then call this WSPR object to encode your call, locator and power setting and provide the address of the sym BYTE array so it can fill it up with your message. Typically this would be done in your initialization code.
WSPR.encodeWSPR(string("KO7M "), string("CN87"), 27, @sym)
Then in you would in your main loop send each symbol returned.
PUB Main | iSym
repeat iSym from 0 to 161
Sync := nextSync
repeat while SecondCnt // Sync
Pretty simple and it works quite well. I have a couple of caveats that are important in the current implementation.
- Only standard WSPR messages are supported currently. No six digit locators or calls with prefixes or suffixes such as KO7M/5 or JA2/KO7M. I have more work to do to support these special message formats.
- Call signs must be exactly 6 characters and the third character must be a numeric. This is according to Joe Taylor's specifications. The point of this is that my routine does not do any error checking to be sure you passed in the call sign with the numeric aligned in the third character and that it is padded with spaces to make it exactly 6 characters. You will need to attend to this in the parameter you pass to encodeWSPR or the results will not be predictable. For example, my call is passed as KO7M<space><space>. If you had a call like one of the special even calls of "K7S", it would need to be passed in as <space>K7S<space><space>. I may attend to this in future versions if I get inspired to do the work.
If I pass the parameters like so:
mycall BYTE "KO7M ", 0
myloc BYTE "CN87", 0
mypwr BYTE 27
WSPR.encodeWSPR(@mycall, @myloc, @mypwr, @sym)
The results are not encoded correctly. Changing to use the "string("...") format rather than BYTE data block constants with exactly the same data shown above works correctly. So, you will have to stick to this format until I figure out why there is any difference. Any thoughts on this from any of you propeller hackers out there appreciated.