Statistics
| Revision:

root / trunk / tp_info6 / Emb_App / can.c @ 1

History | View | Annotate | Download (1.26 KB)

1
// subroutines for control ADC0 in one shot mode with sweep on channels 0 & 1
2

    
3
#ifdef M32C87
4
        #include "sfr32c87.h"
5
#endif
6

    
7
#ifdef M32C83
8
        #include "sfr32c83.h"
9
#endif
10

    
11
#if M32C87
12
// Carte M32C87 Cust GE
13
void can_init(void)
14
{
15
     pd0 = 0xE0;                             // pd10 (bit 7,6,5) configured for outputs
16
     pu00 = 0;                                // no pull up for inputs p0_3..p0_0
17
     ad0con0 = 0x18;                           // one shot sweep mode 0 Fad=Fosc/4
18
     ad0con1 = 0x28;                           // Vref connected resolution 10 bits
19
     ad0con2 = 0x05;                           // CAN connected on port 0 sample&hold active
20
         ad0con3 = 0x00;                                // no sweep mode on severals ports
21
         ad0con4 = 0x00;                                // no use for severals ports
22
         adst_ad0con0 = 1;                                // Run conversion
23
}
24
#endif
25

    
26
#ifdef M32C83
27
// Carte M32C83 LP
28
void can_init(void)
29
{
30
    pd10 = 0x00;                        //conversion sur voie 0 et 1 port 10 
31
    pur3 = 0x00;                        //pas de resistance de tirage
32
    ad0con2 = 0x01;                     //echantillonneur bloqueur actif
33
    ad0con1 = 0x38;                     //Vref connecte mode 10 bits
34
    ad0con0 = 0x18;                     //Fad/3 declenchement logiciel en mode balayage continu
35
    adst_ad0con0 = 1;                   //depart conversion
36
}
37
#endif