DSPRelated.com
Forums

Is there a software FSK encoder API for PC using no addtl hardware?

Started by Tomer August 27, 2003
Vladimir Vassilevsky <vlv@abvolt.com> wrote in message news:<3F4E931A.F2125669@abvolt.com>...
> Les Cargill wrote: > > > > > Can I do all that on a PC soundcard with no additional hardware? > > I'd think so. I am not current on what sort of timer support > > Windows has, but you'll need sub-millisecond timer resolution. > > You might need DMA - depends. > > The Win32 wave API takes care about all timing issues. The only drawback > is the buffering delay which should be at least 100ms to get a reliable > work. > I didn't try Windows DirectSound or WDM API. It is declared that you can > have the delay as low as 10ms in those modes. > > Vladimir Vassilevsky > > DSP and Mixed Signal Design Consultant > > http://www.abvolt.com
Dont laugh, but will something like this work on a WinNT PC? (Beep is a win32 api function): static char buff[]="ZCZC-CIV-SFW-12334"; //send the above buffer in FSK void sendbuff_fsk() { //convert buffer to bits int buffsize=sizeof(buff)/sizeof(char); for (int j=0;j<buffsize;j++) { char c=buff[j]; for (int i=0;i<8;i++) { if (c & (0x80>>i) ) { Beep(2083,2); } else { Beep(1563,2); } } } } basically it converts the buffer to bits. if the bit is 1 it beeps with a frequency of 2083 hz for 2ms. if it is 0, it beeps with frequency of 1563 for 2 ms

Tomer wrote:
> > > Dont laugh, but will something like this work on a WinNT PC? (Beep is > a win32 api function): > > static char buff[]="ZCZC-CIV-SFW-12334"; > > //send the above buffer in FSK > void sendbuff_fsk() > { > //convert buffer to bits > int buffsize=sizeof(buff)/sizeof(char); > for (int j=0;j<buffsize;j++) { > char c=buff[j]; > for (int i=0;i<8;i++) { > if (c & (0x80>>i) ) { > Beep(2083,2); > } else { > Beep(1563,2); > } > } > } > } > > basically it converts the buffer to bits. if the bit is 1 it beeps > with a frequency of 2083 hz for 2ms. if it is 0, it beeps with > frequency of 1563 for 2 ms
I don't think that will work well because it takes some arbitrary time to start every Beep(). Also the transition from Beep(2083,) to Beep(1563,) is not going to be continuos phase. Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com
tomerp55@hotmail.com (Tomer) wrote in message news:<11d3cf88.0308281412.75b0db00@posting.google.com>...
> Thanks for your reply. > > Basically, as I wrote in another reply on the group (and I will now > repeat myself just to make sure you get all the info), I do know that > the FSK signal will have to > adhere to the following criteria: > > The transmission of the characters has to be at a rate of 520.83 bits > per second. Mark frequency is 2083.3 Hz and space frequency is 1562.5 > Hz. Mark and space time must be 1.92 milliseconds. Characters are > ASCII seven bit characters as defined in ANSI X3.4-1977 ending with an > eighth null bit (either 1 or 0) to constitute a full eight-bit byte. > > Now, assuming I can do the above on a PC SoundCard, I will still have > to test my work. I am missing a way to test that the signal I will > output is correct > since the target system is not available. However I thought I could > find some device that will take in the FSK signal that the PC > soundcard would produce and reproduce the characters. This way I will > know my modulation is correct. >
This is a slow binary FSK - a nice project. There are PC audio oscilloscope software toys on the shareware sites. You could use that to test your transmitter, using another PC as a receiver. I would suggest that you also output a stream of data to a file and graph it using a spreadsheet, eg OpenOffice.org Calc. What is not mentioned, is whether the FSK should be phase continuous or not. If your professor did not specify that, then you could cut a corner and record two WAV files, one for each tone and simply play them to generate the FSK. Since the baud rate is so low, the signal need not be phase continuous to be demodulated. There are actually shareware floating around that does exactly that too, for the purpose of DTMF teledialers. However, for better marks, I suggest that you look at my site and use my example C code to make a phase continuous FSK transmitter. Cheers, Herman http://www.AerospaceSoftware.com
Tomer wrote:
> > Vladimir Vassilevsky <vlv@abvolt.com> wrote in message news:<3F4E931A.F2125669@abvolt.com>... > > Les Cargill wrote: > > > > > > > Can I do all that on a PC soundcard with no additional hardware? > > > I'd think so. I am not current on what sort of timer support > > > Windows has, but you'll need sub-millisecond timer resolution. > > > You might need DMA - depends. > > > > The Win32 wave API takes care about all timing issues. The only drawback > > is the buffering delay which should be at least 100ms to get a reliable > > work. > > I didn't try Windows DirectSound or WDM API. It is declared that you can > > have the delay as low as 10ms in those modes. > > > > Vladimir Vassilevsky > > > > DSP and Mixed Signal Design Consultant > > > > http://www.abvolt.com > > Dont laugh, but will something like this work on a WinNT PC? (Beep is > a win32 api function): > > static char buff[]="ZCZC-CIV-SFW-12334"; > > //send the above buffer in FSK > void sendbuff_fsk() > { > //convert buffer to bits > int buffsize=sizeof(buff)/sizeof(char); > for (int j=0;j<buffsize;j++) { > char c=buff[j]; > for (int i=0;i<8;i++) { > if (c & (0x80>>i) ) { > Beep(2083,2); > } else { > Beep(1563,2); > } > } > } > } > > basically it converts the buffer to bits. if the bit is 1 it beeps > with a frequency of 2083 hz for 2ms. if it is 0, it beeps with > frequency of 1563 for 2 ms
I don't think you have enough timing resolution with that approach. -- Les Cargill

Mike Rosing wrote:
> > >>The transmission of the characters has to be at a rate of 520.83 bits > >>per second. Mark frequency is 2083.3 Hz and space frequency is 1562.5 > >>Hz. Mark and space time must be 1.92 milliseconds.
> > Obviously mark is 4 times and space is 3 times bitrate, which allows for > > very simple modulator and demodulator. But why such a weird bit rate? > > If you take 24 hours in a day and 3600 seconds in an hour, then 45e6 bits > per day works out to 520.83 bits per second. Now, why 45 million bits per > day???
Behold the greatest fundamental equation of nature: PI squared equals to the free fall acceleration on the Earth (in SI). However a lot of equipment supports the standard rates 300/600/1200 etc. Also the standard rates and frequencies can be derived from standard crystals. Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com
HermanZA8@netscape.net (Herman Oosthuysen) wrote in message news:<25c456ac.0308281400.257e7800@posting.google.com>...
> tomerp55@hotmail.com (Tomer) wrote in message news:<11d3cf88.0308271133.4b62a45e@posting.google.com>... > > Hi All, > > > Does anyone know if such a thing exists or do I have to code it up > > myself? > > Regarding FSK itself: There are many, many standards eg. Minimal Shift > FSK, Dual Tone FSK, Multi Tone FSK, DTMF, RTTY and so on and many > variations of each. So, you first have to read up a bit, then come > back with a more specific question. > > Cheers, > > Herman > http://www.AerospaceSoftware.com
Well here is as specific as it gets: The transmission of the characters has to be at a rate of 520.83 bits per second. Mark frequency is 2083.3 Hz and space frequency is 1562.5 Hz. Mark and space time must be 1.92 milliseconds. Characters are ASCII seven bit characters as defined in ANSI X3.4-1977 ending with an eighth null bit (either 1 or 0) to constitute a full eight-bit byte. Sounds like a dual tone FSK to me... any ideas on how to do this in software?
> This is a slow binary FSK - a nice project. > > There are PC audio oscilloscope software toys on the shareware sites. > You could use that to test your transmitter, using another PC as a > receiver. > What is not mentioned, is whether the FSK should be phase continuous > or not. If your professor did not specify that, then you could cut a > corner and record two WAV files, one for each tone and simply play > them to generate the FSK. Since the baud rate is so low, the signal > need not be phase continuous to be demodulated.
This actually isnt a school project, but rather a commercial project. I am willing to pay a fair price for an existing well tested implementation of the above FSK protocol, so I can concentrate of the higher levels of the software that I need to implement.
> > There are actually shareware floating around that does exactly that > too, for the purpose of DTMF teledialers. > > However, for better marks, I suggest that you look at my site and use > my example C code to make a phase continuous FSK transmitter.
I have looked at your site, but it seems to be low level ADSP code as opposed to PC code. I need something that will do the above on a PC sound card running windows. Thanks, Tomer
> > Cheers, > > Herman > http://www.AerospaceSoftware.com

Tomer wrote:
> > > This actually isnt a school project, but rather a commercial project. > I am willing to pay a fair price for an existing well tested > implementation of the above FSK protocol, so I can concentrate of the > higher levels of the software that I need to implement.
I would be glad to help you with Windows based FSK encoder/decoder. Call (580)336-7949 or email vlv@abvolt.com
tomerp55@hotmail.com (Tomer) wrote in message news:<11d3cf88.0308291008.570118dc@posting.google.com>...
> HermanZA8@netscape.net (Herman Oosthuysen) wrote in message news:<25c456ac.0308281400.257e7800@posting.google.com>... > > tomerp55@hotmail.com (Tomer) wrote in message news:<11d3cf88.0308271133.4b62a45e@posting.google.com>... > > > Hi All, > > > > Does anyone know if such a thing exists or do I have to code it up > > > myself? > > > > Regarding FSK itself: There are many, many standards eg. Minimal Shift > > FSK, Dual Tone FSK, Multi Tone FSK, DTMF, RTTY and so on and many > > variations of each. So, you first have to read up a bit, then come > > back with a more specific question. > > > > Cheers, > > > > Herman > > http://www.AerospaceSoftware.com > > Well here is as specific as it gets: > The transmission of the characters has to be at a rate of 520.83 bits > per second. Mark frequency is 2083.3 Hz and space frequency is 1562.5 > Hz. Mark and space time must be 1.92 milliseconds. Characters are > ASCII seven bit characters as defined in ANSI X3.4-1977 ending with an > eighth null bit (either 1 or 0) to constitute a full eight-bit byte. > > Sounds like a dual tone FSK to me... any ideas on how to do this in software?
Read this carefully and you'll get the idea: http://www.aerospacesoftware.com/dtmf.htm It is very simple to do. Yes, it is ADSP assembler, but that is easy to follow since it is C like. You just step through the table, get the samples and add them. Cheers, Herman