PDA

View Full Version : 16F1827 table not behaving as expected



J. Mark Wolf
- 1st April 2011, 03:06
I have a table populated with 254 word-size dwell parameters.

My 16F1827 is generating the proper range of vectors (0 - 254) to get into the table, but it's coming back with nonsense.

Screen capture below:

The left portion of the screen is my table with Serout2 commands to report the two variables inquestion, Measurement and DacDwell, immediately upon exiting the table.

The right portion of the screen capture shows the printout from the two Serout2 commands.

As you can see, the DacDwell parameter slams between $0000 and $061b, when varying the vector variable just slightly.

I'm assuming that a byte variable is adequate for vectoring into the table, since there are only 253 "items". Do I have this correct? In fact changing Measurement to a word variable had no effect.

I know it's probably something stupid I'm doing, but can anyone spot the problem?

5313

Darrel Taylor
- 1st April 2011, 04:58
Well, the table has 254 elements, so it goes from 0 - 253.
When the value is 254 it doesn't change the output variable.

But you woud think the other numbers should have a value...:confused:

Can you post the table so I don't have to retype it?
I'll take a look tomorrow.

Bruce
- 1st April 2011, 12:25
For LOOKUP2 your table is limited to 85 list items unless you're using an 18F part..:)

J. Mark Wolf
- 1st April 2011, 12:28
Well, the table has 254 elements, so it goes from 0 - 253.
When the value is 254 it doesn't change the output variable.

But you woud think the other numbers should have a value...:confused:

Can you post the table so I don't have to retype it?
I'll take a look tomorrow.

Hi Darrel

You're correct, I mispoke, 254 items in the table.

Thanks for looking.

Table below:

'
'************************************************* ******************************
'
' The table below forms the basis for a variable frequency amplitude modulator, the envelope for which is
' generated from the 16F1827 on-board DAC and table below.
'
' This table contains the values for the dwell time between each DAC point
' of the envelope. It corresponds to A2D measurement (counts / 4) of the
' 5volt analog signal.
'
' Measurement = A2D counts / 4 (full range becomes 0 - 255)
'
' DacDwell = microseconds between DAC points
'
'************************************************* ******************************
'
DwellTable:
'
lookup2 Measurement,[$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,_ '0 - 7
$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,_ '8 - 15
$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,_ '16 - 23_
$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,_ '24 - 31
$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,_ '32 - 39
$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,_ '40 - 47
$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,_ '48 - 55
$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,_ '56 - 63
$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,_ '64 - 71
$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,_ '72 - 79
$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,_ '80 - 87
$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,_ '88 - 95
$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,_ '96 - 103
$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,_ '104 - 111
$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,_ '112 - 119
$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,_ '120 - 127
$5161,$4c48,$47ce,$43d1,$403f,$3d09,$3a21,$377d,_ '128 - 135 1.5pps - 2.2pps
$3513,$32dd,$30d4,$2ef3,$2d36,$2b99,$2a18,$28b1,_ '136 - 143 2.3pps - 3.0pps
$2761,$2626,$24fe,$23e7,$22e1,$21e9,$20fe,$2020,_ '144 - 151 3.1pps - 3.8pps
$1f4d,$1e85,$1dc6,$1d10,$1c63,$1bbe,$1b20,$1a89,_ '152 - 159 3.9pps - 4.6pps
$19f9,$196e,$18ea,$186a,$17ef,$177a,$1708,$169b,_ '160 - 167 4.7pps - 5.4pps
$1632,$15cc,$156a,$150c,$14b1,$1458,$1403,$13b0,_ '168 - 175 5.5pps - 6.2pps
$1360,$1313,$12c8,$127f,$1238,$11f4,$11b1,$1170,_ '176 - 183 6.3pps - 7.0pps
$1131,$10f4,$10b9,$107f,$1047,$1010,$0fda,$0fa6,_ '184 - 191 7.1pps - 7.8pps
$0f74,$0f42,$0f12,$0ee3,$0000,$0000,$0000,$0000,_ '192 - 199 7.9pps - 8.2pps & 900Hz w/ no mod
$0000,$0000,$0000,$0000,$0000,$0000,$5161,$4c48,_ '200 - 207 900Hz w/no mod & 1.5pps - 1.6pps
$47ce,$43d1,$403f,$3d09,$3a21,$377d,$3513,$32dd,_ '208 - 215 1.7pps - 2.5pps
$30d4,$2ef3,$2d36,$2b99,$2a18,$28b1,$2761,$2626,_ '216 - 223 2.6pps - 3.3pps
$24fe,$23e7,$22e1,$21e9,$20fe,$2020,$1f4d,$1e85,_ '224 - 231 3.4pps - 4.1pps
$1dc6,$1d10,$1c63,$1bbe,$1b20,$1a89,$19f9,$196e,_ '232 - 239 4.2pps - 4.9pps
$18ea,$186a,$17ef,$177a,$1708,$169b,$1632,$15cc,_ '240 - 247 5.0pps - 5.7pps
$156a,$150c,$14b1,$1458,$1403,$13b0],dacdwell '248 - 253 5.8pps - 6.3pps
'
return

end

J. Mark Wolf
- 1st April 2011, 13:48
For LOOKUP2 your table is limited to 85 list items unless you're using an 18F part..:)

Hi Bruce

The compiler was not balking at the table size, and I confirmed with Darrel that the table size limit has been expanded, and that the manual has not yet been updated to reflect this.

Bruce
- 1st April 2011, 16:06
Hi Mark,

You can run a simple test to see what the limit is with the table attached.

Setup a loop to call your LOOKUP2 routine with an index value from 0 to 99.

Where does it fail?

Darrel Taylor
- 1st April 2011, 19:01
Hi J.,

When you asked about LOOKUP2 previously, I had to ask.
The answer I got was 256.

That was only half right.
The compiler executable was changed ... but the macro's were not.
So while the compiler won't complain up to 256 ... the macros only work up to 85. (256/3)

Charles says the executable will be changed back to 85.
I think the macros should be changed to work with 256, but I'd have to do it in that case.
Unless Bruce beats me to it. :D

Are those EXT tables looking better yet?

Bruce
- 1st April 2011, 20:19
Unless Bruce beats me to it. :D

Nice try, but I'll wait for the patch....:D

If you could yank Charles off those dang race cars, I bet he could fix it ASAP...;o)

J. Mark Wolf
- 2nd April 2011, 00:21
Hi Mark,

You can run a simple test to see what the limit is with the table attached.

Setup a loop to call your LOOKUP2 routine with an index value from 0 to 99.

Where does it fail?

Hi Bruce

I thought the same thing driving home from work.

I tried it and it does indeed go "off in the weeds" after reading 85 elements.

So I take it that mere mortals cannot tweak the macros?

I can decimate my table to remove the leading zero "placekeepers" and redundant upper section to get below 85 elements, but then I'll have to play some other games to assert some artificial offsets to enter the table correctly under differing circumstances.

This is a case where the compiler/macros really should be tweaked to allow larger tables, to allow things like thermistor tables, etc.

Maybe small table limits made sense back when the devices had little code space, but that's not as true anymore.

Bruce
- 2nd April 2011, 18:48
Hi Mark,

You can tweak the macros if you want, but I don't recommend it unless you're as good as Darrel...:)

The 85 limit is because the compiler generates 3 table entries per list value. 3 x 85 = 255, which is the largest number that fits in the W register.

It would be easier to just use three lookup2 tables with a select case to jump to the appropriate lookup2 routine.

J. Mark Wolf
- 2nd April 2011, 18:49
I tried breaking up my 254-element table into four 64-element tables as mark_s suggested in another thread, but it's giving more trouble and now "Crossing Page Bounday errors".

It behave as though PBP only allows one LOOKUP2 table construct per program. The DacDwell variable returns with the proper value only if the Measurement variable is contained within the original "called" table.

I've inserted some serial traps to show if the index is working properly between the tables (it is), and to show if the table result is working properly (it isn't)

You can see on the right side of the JPG the serial messages showing the Measurement variable changing to the appropriate table as the Measurement variable increments/decrements, but the DacDwell variable shows zero when it references the second table.

When the Measurement variable increments to 64 or above, it would normally advance to the next table and return the DacDwell values found there, but as youcan see it returns zeros.

I only have room for DwellTable 3 & 4 in the screenshot (DwellTable 1 & 2 contain nothing but zeros for padding), but if I force the Measurement variable to DwellTable to 3 or 4, it will return the proper values until it crosses to the next table construct

So far I'm damned if I do and damned if I don't with respect to these tables.

I'm staring to consider one of the newer "K" parts, but I'm afraid I'll run into compiler deficiencies there as well.

Still not sure if someone is going to fix the macros to match the executable, or drop back to a 85-element limit.

Can anyone offer a way forward?

JPG and code below:

5318


[CODE]'
DwellTable3:
'if measurement > 191 then goto DwellTable4
lookup2 Measurement,[$5161,$4c48,$47ce,$43d1,$403f,$3d09,$3a21,$377d,_ '128 - 135 1.5pps - 2.2pps
$3513,$32dd,$30d4,$2ef3,$2d36,$2b99,$2a18,$28b1,_ '136 - 143 2.3pps - 3.0pps
$2761,$2626,$24fe,$23e7,$22e1,$21e9,$20fe,$2020,_ '144 - 151 3.1pps - 3.8pps
$1f4d,$1e85,$1dc6,$1d10,$1c63,$1bbe,$1b20,$1a89,_ '152 - 159 3.9pps - 4.6pps
$19f9,$196e,$18ea,$186a,$17ef,$177a,$1708,$169b,_ '160 - 167 4.7pps - 5.4pps
$1632,$15cc,$156a,$150c,$14b1,$1458,$1403,$13b0,_ '168 - 175 5.5pps - 6.2pps
$1360,$1313,$12c8,$127f,$1238,$11f4,$11b1,$1170,_ '176 - 183 6.3pps - 7.0pps
$1131,$10f4,$10b9,$107f,$1047,$1010,$0fda,$0fa6],dacdwell3 '184 - 191 7.1pps - 7.8pps
serout2 portb.5,396,["Measurement = ", dec measurement, 13, 10]
serout2 portb.5,396,["DacDwell3 = ", isHEX4 DacDwell3, 13, 10]
serout2 portb.5,396,[13, 10] '
pause 1000
return
'goto Endtable
'
DwellTable4:
lookup2 Measurement,[$0f74,$0f42,$0f12,$0ee3,$0000,$0000,$0000,$0000,_ '192 - 199 7.9pps - 8.2pps & 900Hz w/ no mod
$0000,$0000,$0000,$0000,$0000,$0000,$5161,$4c48,_ '200 - 207 900Hz w/no mod & 1.5pps - 1.6pps
$47ce,$43d1,$403f,$3d09,$3a21,$377d,$3513,$32dd,_ '208 - 215 1.7pps - 2.5pps
$30d4,$2ef3,$2d36,$2b99,$2a18,$28b1,$2761,$2626,_ '216 - 223 2.6pps - 3.3pps
$24fe,$23e7,$22e1,$21e9,$20fe,$2020,$1f4d,$1e85,_ '224 - 231 3.4pps - 4.1pps
$1dc6,$1d10,$1c63,$1bbe,$1b20,$1a89,$19f9,$196e,_ '232 - 239 4.2pps - 4.9pps
$18ea,$186a,$17ef,$177a,$1708,$169b,$1632,$15cc,_ '240 - 247 5.0pps - 5.7pps
$156a,$150c,$14b1,$1458,$1403,$13b0],dacdwell4 '248 - 253 5.8pps - 6.3pps
serout2 portb.5,396,["Measurement = ", dec measurement, 13, 10]
serout2 portb.5,396,["DacDwell4 = ", isHEX4 DacDwell4, 13, 10]
serout2 portb.5,396,[13, 10] '
pause 1000
return'[CODE]

mark_s
- 2nd April 2011, 20:04
Hi Mark,
Those error messages are okay.

If I am reading your code correctly you are not off setting the index value. Each lookup2 table has a possible index address of 0 - 85. In your case you need to offset each table by 64

Something like this

If index > 64 then table2
if index > 128 then table3
if index > 192 then table4

Table1: 'No offset

Lookup2 index[1-64]var
return

Table2:

Index = index -64 'offset
Lookup2 index[65 -128]var
return

Table3:

Index = index -128 'offset
Lookup2 index[129-192]var
return

Table4:

Index = index -192 'offset
Lookup2 index[193-256]var
return

Bruce
- 2nd April 2011, 20:47
Something like this should work so you don't alter your index variable.


main:
for Measurement = 0 to 17
gosub DwellTable
next Measurement
goto main

DwellTable:
IF Measurement > 5 THEN Dwel2
lookup2 Measurement,[$0110,$0120,$0130,$0140,$0150,$0160],dacdwell
RETURN

Dwel2:
IF Measurement > 11 THEN Dwel3
lookup2 Measurement-6,[$0111,$0121,$0131,$0141,$0151,$0161],dacdwell
RETURN

Dwel3:
lookup2 Measurement-12,[$0112,$0122,$0132,$0142,$0152,$0162],dacdwell
RETURN

mark_s
- 2nd April 2011, 21:08
Good point Bruce, the way I showed it the index variable would be out of wack.

"Never try to pick up a penny in front of a moving steam roller"

Regards

Bruce
- 2nd April 2011, 23:35
You can save a ton of code space by not including all the zeros in the upper section. Give this a shot.


Measurement var byte
dacdwell var word
dacdwell = 0

main:
FOR Measurement = 0 TO 253 ' 254 total entries
IF Measurement < 128 THEN ' all values with an index < 128 are 0's
dacdwell = 0
GOSUB Show
ELSE
GOSUB DwellTable
ENDIF
NEXT Measurement

FIN:
GOTO FIN

DwellTable:
IF Measurement > 191 THEN DwellTable2
LOOKUP2 Measurement-128,_
[$5161,$4c48,$47ce,$43d1,$403f,$3d09,$3a21,$377d,_ '128 - 135 1.5pps - 2.2pps
$3513,$32dd,$30d4,$2ef3,$2d36,$2b99,$2a18,$28b1,_ '136 - 143 2.3pps - 3.0pps
$2761,$2626,$24fe,$23e7,$22e1,$21e9,$20fe,$2020,_ '144 - 151 3.1pps - 3.8pps
$1f4d,$1e85,$1dc6,$1d10,$1c63,$1bbe,$1b20,$1a89,_ '152 - 159 3.9pps - 4.6pps
$19f9,$196e,$18ea,$186a,$17ef,$177a,$1708,$169b,_ '160 - 167 4.7pps - 5.4pps
$1632,$15cc,$156a,$150c,$14b1,$1458,$1403,$13b0,_ '168 - 175 5.5pps - 6.2pps
$1360,$1313,$12c8,$127f,$1238,$11f4,$11b1,$1170,_ '176 - 183 6.3pps - 7.0pps
$1131,$10f4,$10b9,$107f,$1047,$1010,$0fda,$0fa6],dacdwell '184 - 191 7.1pps - 7.8pps
GOTO Show ' Show results

DwellTable2:
LOOKUP2 Measurement-192,_
[$0f74,$0f42,$0f12,$0ee3,$0000,$0000,$0000,$0000,_ '192 - 199 7.9pps - 8.2pps & 900Hz w/ no mod
$0000,$0000,$0000,$0000,$0000,$0000,$5161,$4c48,_ '200 - 207 900Hz w/no mod & 1.5pps - 1.6pps
$47ce,$43d1,$403f,$3d09,$3a21,$377d,$3513,$32dd,_ '208 - 215 1.7pps - 2.5pps
$30d4,$2ef3,$2d36,$2b99,$2a18,$28b1,$2761,$2626,_ '216 - 223 2.6pps - 3.3pps
$24fe,$23e7,$22e1,$21e9,$20fe,$2020,$1f4d,$1e85,_ '224 - 231 3.4pps - 4.1pps
$1dc6,$1d10,$1c63,$1bbe,$1b20,$1a89,$19f9,$196e,_ '232 - 239 4.2pps - 4.9pps
$18ea,$186a,$17ef,$177a,$1708,$169b,$1632,$15cc,_ '240 - 247 5.0pps - 5.7pps
$156a,$150c,$14b1,$1458,$1403,$13b0],dacdwell '248 - 253 5.8pps - 6.3pps

Show:
serout2 portb.5,396, ["Measurement = ", DEC measurement, 13, 10]
serout2 portb.5,396, ["DacDwell = ", ISHEX4 DacDwell, 13, 10]
serout2 portb.5,396,[13, 10] '
pause 1000
return

end

J. Mark Wolf
- 3rd April 2011, 00:19
Hi Mark,
Those error messages are okay.

If I am reading your code correctly you are not off setting the index value. Each lookup2 table has a possible index address of 0 - 85. In your case you need to offset each table by 64

Something like this

If index > 64 then table2
if index > 128 then table3
if index > 192 then table4

Table1: 'No offset

Lookup2 index[1-64]var
return

Table2:

Index = index -64 'offset
Lookup2 index[65 -128]var
return



Exactly right Mark! I was forgetting to offset the Measurement variable back to zero relative to each table.

The Page Boundary errors went away too!

Thanks for looking!

J. Mark Wolf
- 3rd April 2011, 00:26
Hi Mark,
Those error messages are okay.

If I am reading your code correctly you are not off setting the index value. Each lookup2 table has a possible index address of 0 - 85. In your case you need to offset each table by 64

Something like this

If index > 64 then table2
if index > 128 then table3
if index > 192 then table4

Table1: 'No offset

Lookup2 index[1-64]var
return

Table2:

Index = index -64 'offset
Lookup2 index[65 -128]var
return



Exactly right Mark! I was forgetting to offset the Measurement variable back to zero relative to each table.

The Page Boundary errors went away too!

Thanks for the tips. I've been working on this for hours!

I think my vector is still off by one count, but substantially working code below:


'************************************************* ******************************
'
DwellTable1:
if measurement > 63 then goto DwellTable2
'
Vector = measurement
'
lookup2 Vector, [$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,_ '0 - 7
$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,_ '8 - 15
$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,_ '16 - 23
$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,_ '24 - 31
$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,_ '32 - 39
$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,_ '40 - 47
$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,_ '48 - 55
$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000],dacdwell '56 - 63
goto Endtable
'
DwellTable2:
if measurement > 127 then goto DwellTable3
'
Vector = measurement - 64
'
lookup2 Vector, [$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,_ '64 - 71
$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,_ '72 - 79
$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,_ '80 - 87
$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,_ '88 - 95
$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,_ '96 - 103
$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,_ '104 - 111
$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,_ '112 - 119
$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000],dacdwell '120 - 127
goto Endtable
'
DwellTable3:
if measurement > 191 then goto DwellTable4
'
Vector = measurement - 128
'
lookup2 Vector, [$5161,$4c48,$47ce,$43d1,$403f,$3d09,$3a21,$377d,_ '128 - 135 1.5pps - 2.2pps
$3513,$32dd,$30d4,$2ef3,$2d36,$2b99,$2a18,$28b1,_ '136 - 143 2.3pps - 3.0pps
$2761,$2626,$24fe,$23e7,$22e1,$21e9,$20fe,$2020,_ '144 - 151 3.1pps - 3.8pps
$1f4d,$1e85,$1dc6,$1d10,$1c63,$1bbe,$1b20,$1a89,_ '152 - 159 3.9pps - 4.6pps
$19f9,$196e,$18ea,$186a,$17ef,$177a,$1708,$169b,_ '160 - 167 4.7pps - 5.4pps
$1632,$15cc,$156a,$150c,$14b1,$1458,$1403,$13b0,_ '168 - 175 5.5pps - 6.2pps
$1360,$1313,$12c8,$127f,$1238,$11f4,$11b1,$1170,_ '176 - 183 6.3pps - 7.0pps
$1131,$10f4,$10b9,$107f,$1047,$1010,$0fda,$0fa6],dacdwell '184 - 191 7.1pps - 7.8pps
goto Endtable
'
DwellTable4:
'
Vector = measurement - 192
'
lookup2 vector, [$0f74,$0f42,$0f12,$0ee3,$0000,$0000,$0000,$0000,_ '192 - 199 7.9pps - 8.2pps & 900Hz w/ no mod
$0000,$0000,$0000,$0000,$0000,$0000,$5161,$4c48,_ '200 - 207 900Hz w/no mod & 1.5pps - 1.6pps
$47ce,$43d1,$403f,$3d09,$3a21,$377d,$3513,$32dd,_ '208 - 215 1.7pps - 2.5pps
$30d4,$2ef3,$2d36,$2b99,$2a18,$28b1,$2761,$2626,_ '216 - 223 2.6pps - 3.3pps
$24fe,$23e7,$22e1,$21e9,$20fe,$2020,$1f4d,$1e85,_ '224 - 231 3.4pps - 4.1pps
$1dc6,$1d10,$1c63,$1bbe,$1b20,$1a89,$19f9,$196e,_ '232 - 239 4.2pps - 4.9pps
$18ea,$186a,$17ef,$177a,$1708,$169b,$1632,$15cc,_ '240 - 247 5.0pps - 5.7pps
$156a,$150c,$14b1,$1458,$1403,$13b0],dacdwell '248 - 253 5.8pps - 6.3pps
Endtable:
'
return
'
end

J. Mark Wolf
- 3rd April 2011, 00:31
Something like this should work so you don't alter your index variable.


main:
for Measurement = 0 to 17
gosub DwellTable
next Measurement
goto main

DwellTable:
IF Measurement > 5 THEN Dwel2
lookup2 Measurement,[$0110,$0120,$0130,$0140,$0150,$0160],dacdwell
RETURN

Dwel2:
IF Measurement > 11 THEN Dwel3
lookup2 Measurement-6,[$0111,$0121,$0131,$0141,$0151,$0161],dacdwell
RETURN

Dwel3:
lookup2 Measurement-12,[$0112,$0122,$0132,$0142,$0152,$0162],dacdwell
RETURN

Hi Bruce

Yup, that's what ended up working.

Thanks.

J. Mark Wolf
- 3rd April 2011, 00:41
You can save a ton of code space by not including all the zeros in the upper section. Give this a shot.


Measurement var byte
dacdwell var word
dacdwell = 0

main:
FOR Measurement = 0 TO 253 ' 254 total entries
IF Measurement < 128 THEN ' all values with an index < 128 are 0's
dacdwell = 0
GOSUB Show
ELSE
GOSUB DwellTable
ENDIF
NEXT Measurement

FIN:
GOTO FIN

DwellTable:
IF Measurement > 191 THEN DwellTable2
LOOKUP2 Measurement-128,_
[$5161,$4c48,$47ce,$43d1,$403f,$3d09,$3a21,$377d,_ '128 - 135 1.5pps - 2.2pps
$3513,$32dd,$30d4,$2ef3,$2d36,$2b99,$2a18,$28b1,_ '136 - 143 2.3pps - 3.0pps
$2761,$2626,$24fe,$23e7,$22e1,$21e9,$20fe,$2020,_ '144 - 151 3.1pps - 3.8pps
$1f4d,$1e85,$1dc6,$1d10,$1c63,$1bbe,$1b20,$1a89,_ '152 - 159 3.9pps - 4.6pps
$19f9,$196e,$18ea,$186a,$17ef,$177a,$1708,$169b,_ '160 - 167 4.7pps - 5.4pps
$1632,$15cc,$156a,$150c,$14b1,$1458,$1403,$13b0,_ '168 - 175 5.5pps - 6.2pps
$1360,$1313,$12c8,$127f,$1238,$11f4,$11b1,$1170,_ '176 - 183 6.3pps - 7.0pps
$1131,$10f4,$10b9,$107f,$1047,$1010,$0fda,$0fa6],dacdwell '184 - 191 7.1pps - 7.8pps
GOTO Show ' Show results

DwellTable2:
LOOKUP2 Measurement-192,_
[$0f74,$0f42,$0f12,$0ee3,$0000,$0000,$0000,$0000,_ '192 - 199 7.9pps - 8.2pps & 900Hz w/ no mod
$0000,$0000,$0000,$0000,$0000,$0000,$5161,$4c48,_ '200 - 207 900Hz w/no mod & 1.5pps - 1.6pps
$47ce,$43d1,$403f,$3d09,$3a21,$377d,$3513,$32dd,_ '208 - 215 1.7pps - 2.5pps
$30d4,$2ef3,$2d36,$2b99,$2a18,$28b1,$2761,$2626,_ '216 - 223 2.6pps - 3.3pps
$24fe,$23e7,$22e1,$21e9,$20fe,$2020,$1f4d,$1e85,_ '224 - 231 3.4pps - 4.1pps
$1dc6,$1d10,$1c63,$1bbe,$1b20,$1a89,$19f9,$196e,_ '232 - 239 4.2pps - 4.9pps
$18ea,$186a,$17ef,$177a,$1708,$169b,$1632,$15cc,_ '240 - 247 5.0pps - 5.7pps
$156a,$150c,$14b1,$1458,$1403,$13b0],dacdwell '248 - 253 5.8pps - 6.3pps

Show:
serout2 portb.5,396, ["Measurement = ", DEC measurement, 13, 10]
serout2 portb.5,396, ["DacDwell = ", ISHEX4 DacDwell, 13, 10]
serout2 portb.5,396,[13, 10] '
pause 1000
return

end


Hi Bruce

I was trying to implement something like that earlier as part of trying to fix the table issue. Now that the tables are fixed it'll be nice to loose all the leading zeroes!

This project has been challenging but interesting.

It's an audible annunciator with a variable sweep tone burst to indicate urgency, with a variable frequency amplitude modulator.

All scaled to fit within the table limits of PBP!

Thanks for the help.