实验一 裸机开发环境搭建和汇编程序编程(LED灯)

  1. .equ GPH3CON, 0XE0200C60
  2. .equ GPH3DAT, 0XE0200C64
  3. .section .text
  4. .globl _start
  5. _start:
  6. start:
  7. ldr r0,=GPH3CON
  8. ldr r1,=0x11110000 @set gpio gpg3 output mode
  9. str r1,[r0]
  10. loop:
  11. ldr r0,=GPH3DAT
  12. mov r1,#0xff
  13. str r1,[r0]
  14. ldr r0,=GPH3DAT
  15. mov r1,#0x0
  16. str r1,[r0]
  17. ldr r0,=GPH3DAT
  18. mov r1,#0xff
  19. str r1,[r0]
  20. ldr r0,=GPH3DAT
  21. mov r1,#0xef
  22. str r1,[r0]
  23. ldr r0,=GPH3DAT
  24. mov r1,#0xdf
  25. str r1,[r0]
  26. ldr r0,=GPH3DAT
  27. mov r1,#0xbf
  28. str r1,[r0]
  29. ldr r0,=GPH3DAT
  30. mov r1,#0x7f
  31. str r1,[r0]
  32. b loop
  33. .end

实验二 GPIO控制实验(数码管)

  1. #include "s5pc210.h"
  2. #include "uart.h"
  3. #define U8 unsigned char
  4. unsigned char seg7table[16] = {
  5. /* 0 1 2 3 4 5 6 7*/
  6. 0xc0, 0xf9, 0xa4, 0xb0, 0x99, 0x92, 0x82, 0xf8,
  7. /* 8 9 A B C D E F*/
  8. 0x80, 0x90, 0x88, 0x83, 0xc6, 0xa1, 0x86, 0x8e,
  9. };
  10. /*****************************************************************************
  11. // Function name : delay
  12. // Description : 延时子程序
  13. // Return type : void
  14. // Argument : count,延时的数值
  15. *****************************************************************************/
  16. void delay( int count )
  17. {
  18. int cnt;
  19. for( count = count; count>0; count--)
  20. for( cnt = 0; cnt < 1000; cnt++);
  21. }
  22. int main()
  23. {
  24. uart_init();
  25. printf("CVT S5PV210 Jtag Seg Test...\n");
  26. int i;
  27. *((U8*) 0x88007000) = 0x00;
  28. for( ; ; ) {
  29. /* 数码管从0到F依次将字符显示出来 */
  30. for(i=0;i<0x10;i++) {
  31. /* 查表并输出数据 */
  32. *((U8*) 0x88009000) = seg7table[i];
  33. delay (1000);
  34. }
  35. /* 数码管从F到0依次将字符显示出来 */
  36. for(i=0xf;i>=0x0;i--) {
  37. /* 查表并输出数据 */
  38. *((U8*) 0x88009000) = seg7table[i];
  39. delay (1000);
  40. }
  41. }
  42. return 0;
  43. }
  1. #include "s5pc210.h"
  2. #include "uart.h"
  3. #define U8 unsigned char
  4. unsigned char seg7table[16] = {
  5. /* 0 1 2 3 4 5 6 7*/
  6. 0xc0, 0xf9, 0xa4, 0xb0, 0x99, 0x92, 0x82, 0xf8,
  7. /* 8 9 A B C D E F*/
  8. 0x80, 0x90, 0x88, 0x83, 0xc6, 0xa1, 0x86, 0x8e,
  9. };
  10. /*****************************************************************************
  11. // Function name : delay
  12. // Description : 延时子程序
  13. // Return type : void
  14. // Argument : count,延时的数值
  15. *****************************************************************************/
  16. void delay( int count )
  17. {
  18. int cnt;
  19. for( count = count; count>0; count--)
  20. for( cnt = 0; cnt < 1000; cnt++);
  21. }
  22. int main()
  23. {
  24. uart_init();
  25. printf("CVT S5PV210 Jtag Seg Test...\n");
  26. int i,j=0;
  27. *((U8*) 0x88007000) = 0x00;
  28. for( ; ; ) {
  29. *((U8*) 0x88007000) = ~(0x1<<j++);
  30. *((U8*) 0x88009000) = seg7table[8];
  31. delay (1000);
  32. //delay (1);
  33. *((U8*) 0x88007000) = ~(0x1<<j++);
  34. *((U8*) 0x88009000) = seg7table[7];
  35. delay (1000);
  36. //delay (1);
  37. *((U8*) 0x88007000) = ~(0x1<<j++);
  38. *((U8*) 0x88009000) = seg7table[0];
  39. delay (1000);
  40. //delay (1);
  41. *((U8*) 0x88007000) = ~(0x1<<j++);
  42. *((U8*) 0x88009000) = seg7table[9];
  43. delay (1000);
  44. //delay (1);
  45. *((U8*) 0x88007000) = ~(0x1<<j++);
  46. *((U8*) 0x88009000) = seg7table[8];
  47. delay (1000);
  48. //delay (1);
  49. *((U8*) 0x88007000) = ~(0x1<<j++);
  50. *((U8*) 0x88009000) = seg7table[4];
  51. delay (1000);
  52. //delay (1);
  53. j=0;
  54. int k=0;
  55. for(;;){
  56. *((U8*) 0x88007000) = ~(0x1<<j++);
  57. *((U8*) 0x88009000) = seg7table[8];
  58. //delay (1000);
  59. delay (1);
  60. *((U8*) 0x88007000) = ~(0x1<<j++);
  61. *((U8*) 0x88009000) = seg7table[7];
  62. //delay (1000);
  63. delay (1);
  64. *((U8*) 0x88007000) = ~(0x1<<j++);
  65. *((U8*) 0x88009000) = seg7table[0];
  66. //delay (1000);
  67. delay (1);
  68. *((U8*) 0x88007000) = ~(0x1<<j++);
  69. *((U8*) 0x88009000) = seg7table[9];
  70. //delay (1000);
  71. delay (1);
  72. *((U8*) 0x88007000) = ~(0x1<<j++);
  73. *((U8*) 0x88009000) = seg7table[8];
  74. //delay (1000);
  75. delay (1);
  76. *((U8*) 0x88007000) = ~(0x1<<j++);
  77. *((U8*) 0x88009000) = seg7table[4];
  78. //delay (1500);
  79. delay (1);
  80. k++;
  81. j=0;
  82. if(k==500){
  83. break;
  84. }
  85. }
  86. /* 数码管从0到F依次将字符显示出来 */
  87. //for(i=0;i<0x10;i++) {
  88. /* 查表并输出数据 */
  89. // *((U8*) 0x88009000) = seg7table[i];
  90. // delay (1000);
  91. //}
  92. /* 数码管从F到0依次将字符显示出来 */
  93. //for(i=0xf;i>=0x0;i--) {
  94. /* 查表并输出数据 */
  95. // *((U8*) 0x88009000) = seg7table[i];
  96. // delay (1000);
  97. //}
  98. }
  99. return 0;
  100. }

实验三 串口通讯实验(UART)

  1. Main.c如下:
  2. #include "s5pc210.h"
  3. #include "uart.h"
  4. /*****************************************************************************
  5. // Function name : delay
  6. // Description : 延时子程序
  7. // Return type : void
  8. // Argument : count,延时的数值
  9. *****************************************************************************/
  10. void delay( int count )
  11. {
  12. int cnt;
  13. for( count = count; count>0; count--)
  14. for( cnt = 0; cnt < 1000; cnt++);
  15. }
  16. int main()
  17. {
  18. uart_init(115200);
  19. Uart_Select(2);
  20. printf("CVT S5PV210 Jtag Uart Test...\n");
  21. while(1){
  22. unsigned char ch = 'a';
  23. ch = Uart_Getch();
  24. Uart_SendByte(ch);
  25. if(ch == 0x0d)
  26. Uart_SendByte(0x0a);
  27. }
  28. }
  1. GPA1.GPA1CON = 0X22; //enable GPA0 pin function mode
  2. UART2.UFCON2 = 0X00; //disable fifo
  3. UART2.UMCON2 = 0X00; //disable AFC
  4. UART2.ULCON2 = 0X03; //data length 8 bit
  5. UART2.UCON2 = 0X305; //
  6. UART2.UBRDIV2 = 0x23; // Baud rate divisior register 115200
  7. UART2.UDIVSLOT2 = 0X3;

实验四 PWM实验(蜂鸣器)

  1. #include "s5pc210.h"
  2. #include "uart.h"
  3. void delay( int count )
  4. {
  5. int cnt;
  6. for( count = count; count>0; count--) for( cnt = 0; cnt < 1000; cnt++);
  7. }
  8. int main()
  9. {
  10. uart_init();
  11. printf("CVT S5PV210 Jtag PWM Test...\n");
  12. GPD0.GPD0CON = (GPD0.GPD0CON & (~0xF000) | (0x2 << 12));//设置 Tout3 输出
  13. TIMER.TCFG0 = (TIMER.TCFG0 & ~0xFF ) | 0xFF; //配置预分频值为 256
  14. TIMER.TCFG1 = (TIMER.TCFG1 & ~0xF000) | 4 <<12;//配置分频的值为 1/16 分频
  15. TIMER.TCNTB3 = 1280;