📄 f411_vr_dpcm.lst
字号:
268 5 // fifth tier
269 5 else
270 5 {
271 6 dpcm_code = 56;
272 6 }
273 5 }
274 4 }
275 3 }
276 2 // second tier
277 2 else
278 2 {
279 3 // third tier
280 3 if (sample_diff_us >= quant20)
281 3 {
282 4 // fourth tier
283 4 if (sample_diff_us >= quant22)
284 4 {
285 5 // fifth tier
286 5 if (sample_diff_us >= quant23)
287 5 {
288 6 dpcm_code = 55;
289 6 }
290 5 // fifth tier
291 5 else
292 5 {
293 6 dpcm_code = 54;
294 6 }
295 5 }
296 4 // fourth tier
297 4 else
298 4 {
299 5 // fifth tier
300 5 if (sample_diff_us >= quant21)
301 5 {
302 6 dpcm_code = 53;
303 6 }
C51 COMPILER V7.06 F411_VR_DPCM 02/18/2009 16:30:49 PAGE 6
304 5 // fifth tier
305 5 else
306 5 {
307 6 dpcm_code = 52;
308 6 }
309 5 }
310 4 }
311 3 // third tier
312 3 else
313 3 {
314 4 // fourth tier
315 4 if (sample_diff_us >= quant18)
316 4 {
317 5 // fifth tier
318 5 if (sample_diff_us >= quant19)
319 5 {
320 6 dpcm_code = 51;
321 6 }
322 5 // fifth tier
323 5 else
324 5 {
325 6 dpcm_code = 50;
326 6 }
327 5 }
328 4 // fourth tier
329 4 else
330 4 {
331 5 // fifth tier
332 5 if (sample_diff_us >= quant17)
333 5 {
334 6 dpcm_code = 49;
335 6 }
336 5 // fifth tier
337 5 else
338 5 {
339 6 dpcm_code = 48;
340 6 }
341 5 }
342 4 }
343 3 }
344 2 }
345 1 // first tier
346 1 else
347 1 {
348 2 // second tier
349 2 if (sample_diff_us >= quant8)
350 2 {
351 3 // third tier
352 3 if (sample_diff_us >= quant12)
353 3 {
354 4 // fourth tier
355 4 if (sample_diff_us >= quant14)
356 4 {
357 5 // fifth tier
358 5 if (sample_diff_us >= quant15)
359 5 {
360 6 dpcm_code = 47;
361 6 }
362 5 // fifth tier
363 5 else
364 5 {
365 6 dpcm_code = 46;
C51 COMPILER V7.06 F411_VR_DPCM 02/18/2009 16:30:49 PAGE 7
366 6 }
367 5 }
368 4 // fourth tier
369 4 else
370 4 {
371 5 // fifth tier
372 5 if (sample_diff_us >= quant13)
373 5 {
374 6 dpcm_code = 45;
375 6 }
376 5 // fifth tier
377 5 else
378 5 {
379 6 dpcm_code = 44;
380 6 }
381 5 }
382 4 }
383 3 // third tier
384 3 else
385 3 {
386 4 // fourth tier
387 4 if (sample_diff_us >= quant10)
388 4 {
389 5 // fifth tier
390 5 if (sample_diff_us >= quant11)
391 5 {
392 6 dpcm_code = 43;
393 6 }
394 5 // fifth tier
395 5 else
396 5 {
397 6 dpcm_code = 42;
398 6 }
399 5 }
400 4 // fourth tier
401 4 else
402 4 {
403 5 // fifth tier
404 5 if (sample_diff_us >= quant9)
405 5 {
406 6 dpcm_code = 41;
407 6 }
408 5 // fifth tier
409 5 else
410 5 {
411 6 dpcm_code = 40;
412 6 }
413 5 }
414 4 }
415 3 }
416 2 // second tier
417 2 else
418 2 {
419 3 // third tier
420 3 if (sample_diff_us >= quant4)
421 3 {
422 4 // fourth tier
423 4 if (sample_diff_us >= quant6)
424 4 {
425 5 // fifth tier
426 5 if (sample_diff_us >= quant7)
427 5 {
C51 COMPILER V7.06 F411_VR_DPCM 02/18/2009 16:30:49 PAGE 8
428 6 dpcm_code = 39;
429 6 }
430 5 // fifth tier
431 5 else
432 5 {
433 6 dpcm_code = 38;
434 6 }
435 5 }
436 4 // fourth tier
437 4 else
438 4 {
439 5 // fifth tier
440 5 if (sample_diff_us >= quant5)
441 5 {
442 6 dpcm_code = 37;
443 6 }
444 5 // fifth tier
445 5 else
446 5 {
447 6 dpcm_code = 36;
448 6 }
449 5 }
450 4 }
451 3 // third tier
452 3 else
453 3 {
454 4 // fourth tier
455 4 if (sample_diff_us >= quant2)
456 4 {
457 5 // fifth tier
458 5 if (sample_diff_us >= quant3)
459 5 {
460 6 dpcm_code = 35;
461 6 }
462 5 // fifth tier
463 5 else
464 5 {
465 6 dpcm_code = 34;
466 6 }
467 5 }
468 4 // fourth tier
469 4 else
470 4 {
471 5 // fifth tier
472 5 if (sample_diff_us >= quant1)
473 5 {
474 6 dpcm_code = 33;
475 6 }
476 5 // fifth tier
477 5 else
478 5 {
479 6 dpcm_code = 32;
480 6 }
481 5 }
482 4 }
483 3 }
484 2 }
485 1
486 1 // convert the DPCM code to its 2's compliment if the original sample
487 1 // difference was negative
488 1 // For example, 41 (101001), which represents a difference of 60, 2's
489 1 // complimented becomes 23 (010111), which represents a difference of -60
C51 COMPILER V7.06 F411_VR_DPCM 02/18/2009 16:30:49 PAGE 9
490 1 if (sample_diff < 0)
491 1 {
492 2 dpcm_code = ~dpcm_code + 1; // use the 2's compliment of the dpcm
493 2 // code
494 2 dpcm_code &= 0x3F; // use only the 6 LSBs for the dpcm code
495 2 }
496 1
497 1 return dpcm_code;
498 1 }
499
500 //-----------------------------------------------------------------------------
501 // DPCM_Decode
502 //-----------------------------------------------------------------------------
503 //
504 // Return Value :
505 // 1) short predicted_value - the signed and quantized difference between
506 // the predicted_value and the ADC sample, which is used
507 // create the predicted_value for the next DPCM cycle
508 // range is: -4096 to 4095 (difference of 12-bit values)
509 // Parameters :
510 // 1) char dpcm_code - the 6-bit code indicating the quantized difference
511 // between the old_prediction and the current sample value
512 // range is positive range of 6-bit value: 0 to 63
513 //
514 // Decode the DPCM code to a signed difference between the current predicted
515 // value and the next.
516 //
517 // NOTE: the calling function must have the same register context, so it must
518 // either have the keyword "using 2" or all "using 2" keywords need to be
519 // removed
520 short DPCM_Decode (unsigned char dpcm_code) using 2
521 {
522 1 return Q_VALUES[dpcm_code];
523 1 }
524
525 //-----------------------------------------------------------------------------
526 // End Of File
527 //-----------------------------------------------------------------------------
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 541 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = 128 ----
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -