3043|1

9795

帖子

24

TA的资源

版主

楼主
 

Lpc54102 ODFM/FDM解码 [复制链接]

本帖最后由 littleshrimp 于 2015-5-19 19:20 编辑
Lpc54102 ODFM/FDM解码
为了配合LPC54102FDM解码使用LPC1549生成数据,通过DAC发送
因为LPC1549没有FPUIFFT运算比较慢,我使用查表的方式输出数据。
DAC的最大输出频率为500 kSamples/s,
新键一个数组,DAC的点数为64
  1. //7.8125KHz

  2. uint16_t fqs[9][64] ={

  3. {2248,2446,2641,2831,3012,3185,3346,3495,3630,3749,3853,3939,4006,4055,4085,4095,4085,4055,4006,3939,3853,3749,3630,3495,3346,3185,3012,2831,2641,2446,2248,2047,1846,1648,1453,1263,1082,909,748,599,464,345,241,155,88,39,9,0,9,39,88,55,241,345,464,599,748,909,1082,1263,1453,1648,1846,2047},

  4. {2446,2831,3185,3495,3749,3939,4055,4095,4055,3939,3749,3495,3185,2831,2446,2047,1648,1263,909,599,345,155,39,0,39,155,345,599,909,1263,1648,2047,2446,2831,3185,3495,3749,3939,4055,4095,4055,3939,3749,3495,3185,2831,2446,2047,1648,1263,909,599,345,155,39,0,39,155,345,599,909,1263,1648,2047},

  5. {2641,3185,3630,3939,4085,4055,3853,3495,3012,2446,1846,1263,748,345,88,0,88,345,748,1263,1846,2446,3012,3495,3853,4055,4085,3939,3630,3185,2641,2047,1453,909,464,155,9,39,241,599,1082,1648,2248,2831,3346,3749,4006,4095,4006,3749,3346,2831,2248,1648,1082,599,241,39,9,155,464,909,1453,2047},

  6. {2831,3495,3939,4095,3939,3495,2831,2047,1263,599,155,0,155,599,1263,2047,2831,3495,3939,4095,3939,3495,2831,2047,1263,599,155,0,155,599,1263,2047,2831,3495,3939,4095,3939,3495,2831,2047,1263,599,155,0,155,599,1263,2047,2831,3495,3939,4095,3939,3495,2831,2047,1263,599,155,0,155,599,1263,2047},

  7. {3012,3749,4085,3939,3346,2446,1453,599,88,39,464,1263,2248,3185,3853,4095,3853,3185,2248,1263,464,39,88,599,1453,2446,3346,3939,4085,3749,3012,2047,1082,345,9,155,748,1648,2641,3495,4006,4055,3630,2831,1846,909,241,0,241,909,1846,2831,3630,4055,4006,3495,2641,1648,748,155,9,345,1082,2047},

  8. {3185,3939,4055,3495,2446,1263,345,0,345,1263,2446,3495,4055,3939,3185,2047,909,155,39,599,1648,2831,3749,4095,3749,2831,1648,599,39,155,909,2047,3185,3939,4055,3495,2446,1263,345,0,345,1263,2446,3495,4055,3939,3185,2047,909,155,39,599,1648,2831,3749,4095,3749,2831,1648,599,39,155,909,2047},

  9. {3346,4055,3853,2831,1453,345,9,599,1846,3185,4006,3939,3012,1648,464,0,464,1648,3012,3939,4006,3185,1846,599,9,345,1453,2831,3853,4055,3346,2047,748,39,241,1263,2641,3749,4085,3495,2248,909,88,155,1082,2446,3630,4095,3630,2446,1082,155,88,909,2248,3495,4085,3749,2641,1263,241,39,748,2047},

  10. {3495,4095,3495,2047,599,0,599,2047,3495,4095,3495,2047,599,0,599,2047,3495,4095,3495,2047,599,0,599,2047,3495,4095,3495,2047,599,0,599,2047,3495,4095,3495,2047,599,0,599,2047,3495,4095,3495,2047,599,0,599,2047,3495,4095,3495,2047,599,0,599,2047,3495,4095,3495,2047,599,0,599,2047},

  11. {3630,4055,3012,1263,88,345,1846,3495,4085,3185,1453,155,241,1648,3346,4095,3346,1648,241,155,1453,3185,4085,3495,1846,345,88,1263,3012,4055,3630,2047,464,39,1082,2831,4006,3749,2248,599,9,909,2641,3939,3853,2446,748,0,748,2446,3853,3939,2641,909,9,599,2248,3749,4006,2831,1082,39,464,2047}

  12. };

复制代码
对应的频率为
7.8125KHz~70.3125KHz9组数组
1*500KHz /64Point = 7.8125KHz
8*500KHz/64Point = 62.5KHz
9*500KHz /64Point = 70.3125KHz
将要发送的一个字节数据拆分成8个位,每位对应一个频率,数据为0DAC输出7.8125KHz0位为1时输出7.8125KHz + 7.8125*2KHz,以此类推。
DAC中断里输出数据
  1. void DAC_IRQHandler(void)

  2. {

  3. if

  4. (Chip_DAC_GetIntStatus(LPC_DAC))

  5. {

  6. if(!dacClear)

  7. {

  8. // dacOutValue

  9. = 0;

  10. dacOutValue

  11. = fqs[0][fqsIndex];

  12. dacOutValue

  13. += ((dacOutData & BIT0) == BIT0) ? fqs[1][fqsIndex] : 0;

  14. dacOutValue

  15. += ((dacOutData & BIT1) == BIT1) ? fqs[2][fqsIndex] : 0;

  16. dacOutValue

  17. += ((dacOutData & BIT2) == BIT2) ? fqs[3][fqsIndex] : 0;

  18. dacOutValue

  19. += ((dacOutData & BIT3) == BIT3) ? fqs[4][fqsIndex] : 0;

  20. dacOutValue

  21. += ((dacOutData & BIT4) == BIT4) ? fqs[5][fqsIndex] : 0;

  22. dacOutValue

  23. += ((dacOutData & BIT5) == BIT5) ? fqs[6][fqsIndex] : 0;

  24. dacOutValue

  25. += ((dacOutData & BIT6) == BIT6) ? fqs[7][fqsIndex] : 0;

  26. dacOutValue

  27. += ((dacOutData & BIT7) == BIT7) ? fqs[8][fqsIndex] : 0;

  28. dacOutValue

  29. /= (numbits_lookup_table[dacOutData]+1);

  30. Chip_DAC_UpdateValue(LPC_DAC,

  31. dacOutValue);

  32. fqsIndex++;

  33. if(fqsIndex

  34. >= length)

  35. {

  36. fqsIndex

  37. = 0;

  38. }

  39. }

  40. else

  41. {

  42. fqsIndex

  43. = 0;

  44. //输出低电平

  45. Chip_DAC_UpdateValue(LPC_DAC,

  46. 0);

  47. }

  48. }

  49. }

复制代码
完成DAC FDM编码后开始写LPC54102 FDM解码程序
为了实现精准采样采用SystemTick定时器给ADC发送开始采样信号
  1. void SysTick_Handler(void)

  2. {

  3. am_led_toggle(0);

  4. /*

  5. 启动AD转换 */

  6. am_adc_start(g_adc0_handle,

  7. AMHW_ADC0_CHAN_3);

  8. }

复制代码
采集到的数据保存到临时数据,LPC1549输出数据间使用低电平间隔,当LPC54102检测到低电平数大于指定值时向前提取64点有效数据进行FFT转换,判断对应频率下的模值分析LPC1549发送来的数据。
下边是LPC1549发送数据、波形和LPC54102 FFT后对应频率下的模值
0xff
15.png
0xdf
16.png
0x55
17.png
0x0f
18.png
0xf0
20.png
源文件
LPC1549使用lpcopen_2_08c_keil_iar_nxp_lpcxpresso_1549例程修改
lpc1549 dac.c.txt (7.32 KB, 下载次数: 6)
LPC54102使用周立功ametal_easy_arm_lpc5410x_v1.00例程修改
lpc54102 adc.c.txt (6.3 KB, 下载次数: 5)
问题:
LPC1549发送单一数据时LPC54102可以正常解码,如果让LPC1549全速跑起来LPC54102会丢掉一些字符。
一方面是LPC54102做FFT的速度还不够快,另一方面上边的例程是根据自己的理解和想法编写的在算法上肯定也有问题
有时间好好研究一下OFDM原理,弄明白后再写一个像样的程序。
此帖出自NXP MCU论坛

最新回复

进来学习一下,没怎么看明白,不明觉厉  详情 回复 发表于 2015-5-19 20:42

赞赏

2

查看全部赞赏

点赞 关注
个人签名虾扯蛋,蛋扯虾,虾扯蛋扯虾
 

回复
举报

1976

帖子

1

TA的资源

五彩晶圆(初级)

沙发
 
进来学习一下,没怎么看明白,不明觉厉
此帖出自NXP MCU论坛
 
 
 

回复
您需要登录后才可以回帖 登录 | 注册

随便看看
查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/7 下一条

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2025 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表