??? 08/30/07 21:12 Read: times |
#143782 - Here's my code... Responding to: ???'s previous message |
...// UART0.c // #define PSD_CSIOP 0x7F00 #include <uPSD33XX.h> #include <stdio.h> void InitSerial(void); unsigned char TxdSerial( unsigned char c ); static unsigned char uart_data; #define FREQ_OSC 40000 main() { BUSCON = 0xC1; // PFQ CLK Frequence 25-40MHz // Initialize the BUSCON register // BUSCON.7 = 1, Prefetch Queue is Enabled // BUSCON.6 = 1, Branch Cache is Enabled // BUSCON.5, BUSCON.4= 00B - 4 PFQCLK for Xdata Write bus cycle // BUSCON.3, BUSCON.2= 00B - 4 PFQCLK for Xdata Read bus cycle // BUSCON.1, BUSCON.0= 01B - 4 PFQCLK for Code Fetch bus cycle InitSerial(); // Does not work with the following line commented out. Cannot go into Turbo Mode. PSD_PMMR0|=0x08; // Disable PSD Module Turbo Mode to save power PSD_PMMR2|=0x3C; // Set PSD Module PLD input blocking bits to save power while (1) { TxdSerial('S'); TxdSerial('J'); TxdSerial('B'); TxdSerial('.'); } } void InitSerial(void) { TI = 0; RCAP2H = 0xFF; RCAP2L = 0xBF; // 40 MHz = should be 19200 Baud but I get 2400 Baud // RCAP2L = 0xF8; // 40 MHz = this get me 19200 Baud T2CON = 0x34; // Enable RCLK & TCLK for baud clock enable // And turn on Timer 2 SCON0 = 0x74; // SCON: mode 1, 8-bit UART, enable rcvr } unsigned char TxdSerial( unsigned char c ) { SBUF0=c; while(!(TI)); TI = 0; return c; } ... |
Topic | Author | Date |
uPSD3354D-40U6 UART0 runs at 1/8 Speed | 01/01/70 00:00 | |
show the UART code | 01/01/70 00:00 | |
post your code... | 01/01/70 00:00 | |
Here's my code... | 01/01/70 00:00 | |
hummm... | 01/01/70 00:00 | |
Here's what ST sent me (and I tried 0x50)![]() | 01/01/70 00:00 |