/[H8]/trunk/PIC/Demo trimmet/barcode.c
ViewVC logotype

Diff of /trunk/PIC/Demo trimmet/barcode.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 110 by hedin, Mon May 28 10:13:48 2007 UTC revision 111 by hedin, Mon May 28 15:00:55 2007 UTC
# Line 28  void barcode_init(void) Line 28  void barcode_init(void)
28          // Set Port C bit 6 output (TxD) and bit 7 input (RxD)          // Set Port C bit 6 output (TxD) and bit 7 input (RxD)
29      TRISC6 = 0;      TRISC6 = 0;
30      TRISC7 = 1;      TRISC7 = 1;
31    /*
32      SPBRG = 25;         //      x = Fosc/(16 * Baud Rate) - 1      SPBRG = 25;         //      x = Fosc/(16 * Baud Rate) - 1
33                                          //      x = 4000000/(16 * 9600) - 1                                          //      x = 4000000/(16 * 9600) - 1
34                                          //      x = 25.0417 ~ 25                                          //      x = 25.0417 ~ 25
35                                          //      Baud Rate = Fosc/(16 * (x+1))                                          //      Baud Rate = Fosc/(16 * (x+1))
36                                          //      Baud Rate = 4000000/(16 * (25+1))                                          //      Baud Rate = 4000000/(16 * (25+1))
37                                          //      Baud Rate = 9615                                          //      Baud Rate = 9615
38                                            */
39                                            
40            SPBRG = 130; //BRG værdi for 20Mhz MCU
41      TXSTA = 0x24;       //      TXSTA7 = 0      Don't care in asynchronous      TXSTA = 0x24;       //      TXSTA7 = 0      Don't care in asynchronous
42                                          //      TXSTA6 = 0      8-bit transmission                                          //      TXSTA6 = 0      8-bit transmission
43                                          //      TXSTA5 = 1      Transmit enabled                                          //      TXSTA5 = 1      Transmit enabled
# Line 106  void /*interrupt*/ barcode_interrupt(voi Line 109  void /*interrupt*/ barcode_interrupt(voi
109                  {                  {
110                          barcode_ready = 1;                          barcode_ready = 1;
111                  }                  }
112                  else                  else
113                  {                  {
114                          global_barcode_buffer[barcode_length++] = RCREG;                          global_barcode_buffer[barcode_length++] = RCREG;
115                  }                  }
116          }          }
   
           
           
   
117  }  }

Legend:
Removed from v.110  
changed lines
  Added in v.111

  ViewVC Help
Powered by ViewVC 1.1.20