USART HMI串口屏+GPS模块显示时间和经纬度  
  📍相关篇《基于u-box GPS模块通过串口指令调整输出信息》  
   
🌿GPS模块使用的是u-box m8130kt GPS模块 🌿有关具体的GPS配置指令介绍,可以参考上面的相关篇内容。 🌿串口屏主动解析基本知识参考:http://wiki.tjc1688.com/advanced/recmod/recmod_base.html#recmod  
 🔖我这里配置GPS+BEIDOU模式的话,实际上操作的发送相关配置指令给GPS模块。   
if ( usize> 0 && u[ 0 ] != 0x24 && u[ 1 ] != 0x47 ) 
{ 
  udelete 1 
} 
if ( usize>= 2 ) 
{ 
  usize2= usize- 1 
  for ( length= 0 ; length< usize2; length++ ) 
  { 
    if ( u[ length] == 0x0d && u[ length+ 1 ] == 0x0a ) 
    { 
      totalLength= length+ 2 
      ucopy t10. txt, 0 , length, 0 
      udelete totalLength
    } 
  } 
} 
🌿时间信息和经纬度信息,可通过解析$GNRMC、$GNZDA获取。  
 🔨具体数据内容的解析,主要是对字符串数据进行加工处理。   
 
spstr t10. txt, t11. txt, "," , 0  
if ( t11. txt== "$GNRMC" || t11. txt== "$GNZDA" ) 
{ 
  btlen t10. txt, n1. val
} 
if ( t11. txt== "$GNZDA" ) 
{ 
  
  spstr t10. txt, t24. txt, "," , 4 
  spstr t10. txt, t26. txt, "," , 3 
  spstr t10. txt, t25. txt, "," , 2 
} 
if ( t11. txt== "$GNRMC" ) 
{ 
  substr t10. txt, t12. txt, 7 , 6   
  t23. txt= t12. txt
  
  
  
  
  
  spstr t10. txt, t17. txt, "," , 3     
  spstr t10. txt, t16. txt, "," , 5 
  t14. txt= "N" + t17. txt+ "°" + " " + "E" + t16. txt+ "°" 
  
  n0. val= 0 
  covx t23. txt, n0. val, 2 , 0 
  n0. val+= 8 
  if ( n0. val> 24 ) 
  { 
    n0. val-= 24 
    covx n5. val, t13. txt, 2 , 0 
    covx n6. val, t25. txt, 2 , 0 
    n6. val+= 1 
    covx t25. txt, n6. val, 2 , 0 
  } 
  t28. txt= t24. txt+ "-" + t26. txt+ "-" + t25. txt
  if ( t28. txt!= t27. txt) 
  { 
    t27. txt= t28. txt
  } 
  covx n0. val, t22. txt, 0 , 0 
  substr t12. txt, t20. txt, 2 , 2 
  substr t12. txt, t21. txt, 4 , 2 
  t19. txt= t22. txt+ ":" + t20. txt+ ":" + t21. txt
} 
printh B5 62  06  17  14  00  00  41  00  02  00  00  00  00  00  00  00  01  00  00  00  00  00  00  00  00  75  57  B5 62  06  17  00  00  1 D 5 D
delay= 10 
printh B5 62  06  01  03  00  F0 08  01  03  20 
delay= 10 
printh B5 62  06  08  06  00  E8 03  01  00  01  00  01  39  B5 62  06  08  00  00  0 E 30 
delay= 10 
printh B5 62  06  01  03  00  F0 03  00  FD 15 
delay= 10 
printh B5 62  06  01  03  00  F0 05  00  FF 19 
📜配置后的实际输出数据内容:  
 🔖上面的数据信息,其中放到屏幕显示上显示的,只有$GNRMC和$GNZDA,如果全部解析放到屏幕上做动态显示,内容将更新十分频繁,其他的一些数据信息并不是想要的。   
链接:https: 
提取码:s7jf