1677 views|0 replies

6587

Posts

0

Resources
The OP
 

DSP water light source program [Copy link]

This post was last edited by Jacktang on 2019-11-7 22:01

DSP water light source program

  1. /*
  2. * main.c
  3. *
  4. *Created on: 2019-9-2
  5. * Author: CZQ
  6. */
  7. /*
  8. * GPxDAT Set to 1 high level Set to 0 low level
  9. * GPxSET 1---high 0---invalid
  10. * GPxCLEAR 1---low 0---invalid
  11. * GPxTolgole 1 --- Flip
  12. */
  13. #include "DSP2833x_Device.h" // DSP2833x Headerfile Include File
  14. #include "DSP2833x_Examples.h" // DSP2833x Examples Include File
  15. //Declare function
  16. void delay_loop(void);
  17. void Gpio_select(void);
  18. main()
  19. {
  20. InitSysCtrl();
  21. //GPIO configuration
  22. Gpio_select();
  23. // Clear all interrupts and disable CPU global interrupts
  24. DINT;
  25. // Initialize the PIE control registers to their default states
  26. InitPieCtrl();
  27. //Disable CPU interrupts and clear all CPU interrupt flags
  28. IER = 0x0000;
  29. IFR = 0x0000;
  30. //Initialize the PIE interrupt vector table and point it to the interrupt service routine (ISR)
  31. InitPieVectTable();
  32. //User code, LED flashes
  33. GpioDataRegs.GPBDAT.all = 0x30000000;//0x30000000 0061-160-1
  34. GpioDataRegs.GPCDAT.all = 0x00000007;//0x00000007 000 68-067-0 66-1 65-1 64-1
  35. for(;;)
  36. {
  37. GpioDataRegs.GPBDAT.all = 0x1000000;
  38. GpioDataRegs.GPCDAT.all = 0x0000001F;
  39. delay_loop();
  40. GpioDataRegs.GPBDAT.all = 0x20000000;
  41. GpioDataRegs.GPCDAT.all = 0x0000001F;
  42. delay_loop();
  43. GpioDataRegs.GPBDAT.all = 0x30000000;
  44. GpioDataRegs.GPCDAT.all = 0x0000001E;
  45. delay_loop();
  46. GpioDataRegs.GPBDAT.all = 0x30000000;
  47. GpioDataRegs.GPCDAT.all = 0x0000001D;
  48. delay_loop();
  49. GpioDataRegs.GPBDAT.all = 0x30000000;
  50. GpioDataRegs.GPCDAT.all = 0x0000000B;
  51. delay_loop();
  52. GpioDataRegs.GPBDAT.all = 0x30000000;
  53. GpioDataRegs.GPCDAT.all = 0x00000017;
  54. delay_loop();
  55. GpioDataRegs.GPBDAT.all = 0x30000000;
  56. GpioDataRegs.GPCDAT.all = 0x0000000F;
  57. delay_loop();
  58. // delay_loop();
  59. // GpioDataRegs.GPBTOGGLE.all = 0x30000000;
  60. // GpioDataRegs.GPCTOGGLE.all = 0x00000007;
  61. //
  62. // delay_loop();
  63. // GpioDataRegs.GPBTOGGLE.all = 0x30000000;
  64. // GpioDataRegs.GPCTOGGLE.all = 0x00000007;
  65. }
  66. }
  67. //Delay sub-function
  68. void delay_loop()
  69. {
  70. Uint32 i;
  71. Uint32 j;
  72. for(i=0;i<32;i++)
  73. for(j=0;j<100000;j++){}
  74. }
  75. //GPIO initialization function
  76. void Gpio_select(void)
  77. {
  78. EALLOW;
  79. GpioCtrlRegs.GPAMUX1.all = 0x00000000;//ALL GPIO
  80. GpioCtrlRegs.GPAMUX2.all = 0x00000000;
  81. GpioCtrlRegs.GPBMUX1.all = 0x00000000;
  82. GpioCtrlRegs.GPBMUX2.all = 0x00000000;
  83. GpioCtrlRegs.GPCMUX1.all = 0x00000000;
  84. GpioCtrlRegs.GPCMUX2.all = 0x00000000;
  85. GpioCtrlRegs.GPADIR.all = 0xFFFFFFFF; //ALL outputs
  86. GpioCtrlRegs.GPBDIR.all = 0xFFFFFFFF;
  87. GpioCtrlRegs.GPCDIR.all = 0xFFFFFFFF;
  88. EDIS;
  89. }

DSP-流水灯.rar (151.17 KB, downloads: 4)

360截图20191107213748108.jpg (11.46 KB, downloads: 0)

360截图20191107213748108.jpg

360截图20191107213933718.jpg (8.76 KB, downloads: 0)

360截图20191107213933718.jpg

360截图20191107214002117.jpg (13.72 KB, downloads: 0)

360截图20191107214002117.jpg
This post is from Microcontroller MCU
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Related articles more>>
Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list