Hi
Ich Versuche momentan das SPI-Modul des ADuC812 zum laufen zu bekommen,
doch irgendwie funktioniert es nicht. Das Beispielprogramm von Analog
devices funktioniert auch nicht. hat jemand eine Idee woran das liegen
kann?
Hier der Code:
1 | #include <stdio.h> /* prototype declarations for I/O
|
2 | functions */
|
3 | #include <ADuC812.h> /* ADuC812 header file */
|
4 |
|
5 | sbit LED = P3 ^ 4;
|
6 |
|
7 | void wait_ms(int time)
|
8 | {
|
9 | int delay_time,delays;
|
10 | for (delay_time=0; delay_time<time; delay_time++)
|
11 | {
|
12 | for( delays=0;delays<500;delays++);
|
13 | }
|
14 | }
|
15 |
|
16 | void interrup_0 () interrupt 7 // SPI Interrupt Vector Address
|
17 | {
|
18 | ISPI=0;
|
19 | P2=~P2;
|
20 | }
|
21 | void main (void)
|
22 | {
|
23 | EA=1; // Enable global interrupts
|
24 |
|
25 | SCON = 0x52 ; // UART configuration
|
26 | TMOD = 0x20 ; //9600 bauds
|
27 | TH1 = 0xFD ; //1 stop bit
|
28 | TR1 = 1 ; //no parity bit
|
29 |
|
30 | SPICON = 0x30 ; //master mode
|
31 | IE2 = 0x01 ;
|
32 |
|
33 | SPE=1; // enable SPI interrupt
|
34 | while (1) // Wait for ADC interrupt
|
35 | {
|
36 | SPIDAT = 0x55;
|
37 | LED = 1;
|
38 | wait_ms(500);
|
39 | LED = 0;
|
40 | wait_ms(500);
|
41 |
|
42 | }
|
43 | }
|
ICh programmiere mit µVision3. Wenn ich es simulier merke ich, dass nie
ein wert im SPIDAT-Register steht. Warum ist das so?
Achja.... ich benutze das ADuC812QS Evalboard.
PS.: Ich hab mit dem Oszi auch schon die SPI-Pins nachgemessen... tat
tut sich nichts :-(
Kann mir bitte jemand helfen?
mfg SChoasch