Forum: Mikrocontroller und Digitale Elektronik ser. Schnittstelle


von Kartoffel (Gast)


Lesenswert?

Hallo zusammen,
ich bin grad dabei die serielle Schnittstelle des XC167 zum laufen zu 
bringen, d.h. ich will ein Zeichen senden und es dann auch lesen können. 
Also Kommunikationsprogramm hab ich das OC-Console.
Also es will nicht so recht funktionieren, der Code:
1
//****************************************************************************
2
// @Module        Asynchronous/Synchronous Serial Interface (ASC0)
3
4
5
//****************************************************************************
6
// @Function      void ASC0_vInit(void) 
7
//
8
9
// @Returnvalue   None
10
//
11
//----------------------------------------------------------------------------
12
// @Parameters    None
13
//
14
//----------------------------------------------------------------------------
15
// @Date          29.04.2008
16
//
17
//****************************************************************************
18
19
20
void ASC0_vInit(void)
21
{
22
23
  ASC0_BG        =  0x0040;      // load ASC0 baud rate time reload register
24
25
  
26
27
  ASC0_CON       =  0x0001;      // load ASC0 control register
28
29
  
30
  ASC0_RXFCON    =  0x0102;      // load ASC0 receive FIFO control register
31
  ASC0_TXFCON    =  0x0102;      // load ASC0 transmit FIFO control register
32
33
  
34
  ALTSEL0P3     |=  0x0400;      // select alternate output function
35
  P3   = (P3   & ~(uword)0x0400) | 0x0400;    //set data register
36
  DP3  = (DP3  & ~(uword)0x0400) | 0x0400;    //set direction register
37
38
  
39
40
  ASC0_TIC       =  0x005D;     
41
42
  
43
44
  ASC0_RIC       =  0x0059;     
45
46
47
  
48
49
  ASC0_CON      |=  0x8000;      // enable baud rate generator
50
51
52
} //  End of function ASC0_vInit
53
54
55
void ASC0_vSendData(uword uwData)
56
{
57
  ASC0_TBUF    = uwData;   //  load transmit buffer register
58
59
} //  End of function ASC0_vSendData
60
61
62
63
64
// USER CODE BEGIN (Tx,1)
65
66
// USER CODE END
67
68
void ASC0_viTx(void) interrupt ASC0_TINT using RB_LEVEL7
69
{
70
71
  // USER CODE BEGIN (Tx,2)
72
73
 ASC0_vSendData('H');
74
 
75
 
76
  // USER CODE END
77
78
} //  End of function ASC0_viTx
79
80
81
82
// USER CODE BEGIN (Rx,1)
83
84
// USER CODE END
85
86
void ASC0_viRx(void) interrupt ASC0_RINT using RB_LEVEL6
87
{
88
89
90
} //  End of function ASC0_viRx

Weiß vllt. einer, was ich nicht berücksichtigt hab?
Danke

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.