Shop OBEX P1 Docs P2 Docs Learn Events
BS 2 decimal math problem — Parallax Forums

BS 2 decimal math problem

N3JQDN3JQD Posts: 6
edited 2011-07-17 11:34 in BASIC Stamp
I have a BS2 and the Parallax FM receiver board. Everything works, but, I am attempting to program the frequency by use of the RCTIME command. I wish to dial in the frequency directly from the variable pot.
The problem is that I cannot input anything but whole numbers into the FM board. How would one go about inputting decimal values? i.e. 93.3 FM. I can use the sample program from Parallax, but, I want to experiment with 2 variable pots. One for freq. input and one for volume control. Volume is easy, no prob there. Tnx.

Comments

  • mw0868mw0868 Posts: 4
    edited 2011-07-14 18:43
    If you have enough I/O pins left, perhaps you could try one of Parallax's rotary encoder products. Ticks in the clockwise direction could increment the frequency in steps, i.e 93.1, 93.3, 93.5, etc. CCW steps could decrement frequency. You could wrap-around when you reached a frequency limit.
  • Mike GreenMike Green Posts: 23,101
    edited 2011-07-14 18:57
    To use a pot for frequency, you'll have to use units of 100KHz, so your frequency values are 880, 881, ... , 1079. You'd subtract 880 from this to get a range of 0 to 199. You'll have to refer to the documentation on RCTIME to figure out what pot value (and series resistor for the minimum resistance) you'll need to get a range of 200 values. You could also use a larger range of RCTIME values and transform that with subtraction of the base value then division by some constant to get a range of 0 to 199.
  • N3JQDN3JQD Posts: 6
    edited 2011-07-17 11:34
    OK, thanks for the suggestions. Sounds good.
Sign In or Register to comment.