/fishlamp.timer/test/test.e

http://github.com/gbalage/fishlamptimer · Specman e · 112 lines · 94 code · 18 blank · 0 comment · 2 complexity · 4b3c605286b295046dce0d43ce339551 MD5 · raw file

  1. namespace test;
  2. import e.types;
  3. import e.platform;
  4. import microchip.pic18;
  5. import microchip.pic18.assisted;
  6. import microchip.PIC18F14K50;
  7. import dio;
  8. import spi;
  9. import pic18f14k50.eusart;
  10. reg uint8 ANSEL : 0xF7E;
  11. reg uint8 ANSELH : 0xF7F;
  12. wait(){
  13. uint8 counter;
  14. aCLRF(addr(counter));
  15. label countstart;
  16. NOP();
  17. NOP();
  18. NOP();
  19. aINCFSZ(addr(counter));
  20. GOTO(@countstart);
  21. }
  22. wait2(){
  23. uint8 counter;
  24. aCLRF(addr(counter));
  25. label countstart;
  26. wait();
  27. aINCFSZ(addr(counter));
  28. GOTO(@countstart);
  29. }
  30. wait3(){
  31. uint8 counter;
  32. aCLRF(addr(counter));
  33. label countstart;
  34. wait2();
  35. aINCFSZ(addr(counter));
  36. GOTO(@countstart);
  37. }
  38. main(){
  39. uint8 rcv;
  40. uint8 send;
  41. uint8 display;
  42. OSCCON = 0x50;
  43. ANSEL = 0;
  44. ANSELH = 0;
  45. TRISC = 0;
  46. PORTC = 0;
  47. LATC = 0;
  48. send = 0;
  49. rcv = 0;
  50. PORTB = 0;
  51. LATB = 0;
  52. TRISB = 0;
  53. display = 0xFF;
  54. /* Send data to display */
  55. SPI_Send(RC0, RC1, display);
  56. RS232_init();
  57. label start;
  58. /* Communicate */
  59. RS232_syncSend(display,rcv);
  60. if (rcv == display){
  61. }else{
  62. /* Display received value */
  63. display = rcv;
  64. /* Send data to display */
  65. SPI_Send(RC0, RC1, display);
  66. }
  67. wait();
  68. GOTO(@start);
  69. }
  70. binary config{
  71. data {
  72. 0;
  73. CONFIG1H_FCMEN_Disabled+CONFIG1H_IESO_Disabled+CONFIG1H_OSC_INTRCPortonRA6PortonRA7;
  74. CONFIG2L_BODENV__20V+CONFIG2L_BODEN_DisabledinhardwareSBORENdisabled+CONFIG2L_PUT_Disabled;
  75. CONFIG2H_WDTPS__18192+CONFIG2H_WDT_DisabledControlledbySWDTENbit;
  76. 0;
  77. CONFIG3H_CCP2MUX_RB3+CONFIG3H_LPT1OSC_Disabled+CONFIG3H_MCLRE_MCLRDisabledRE3Enabled+CONFIG3H_PBADEN_PORTB40configuredasdigitalIOonRESET;
  78. CONFIG4L_BACKBUG_Disabled+CONFIG4L_ENHCPU_Disabled+CONFIG4L_LVP_Disabled+CONFIG4L_STVR_Disabled;
  79. 0;
  80. CONFIG5L_CP_0_Disabled+CONFIG5L_CP_1_Disabled;
  81. CONFIG5H_CPB_Disabled+CONFIG5H_CPD_Disabled;
  82. CONFIG6L_WRT_0_Disabled+CONFIG6L_WRT_1_Disabled;
  83. 0;
  84. CONFIG7L_EBTR_0_Disabled+CONFIG7L_EBTR_1_Disabled;
  85. CONFIG7H_EBTRB_Disabled;
  86. } at CONFIG_ADDRESS;
  87. }
  88. binary test hexfile{
  89. link main {
  90. memwidth = 8;
  91. mem 0x00..0xeff;
  92. } at 0;
  93. include config at 0;
  94. }