This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

phyCORE-XC167 with XC!67CI

Hallo
Ich arbeite mit einem phyCORE-XC167 with XC167CI
Ich will ein einfachen PWM erzeugen an den Port_1 an den Pin P1L_0 und P1L_1 (Patch Field 40D und 40B).
1:
aber wenn Ich mein Programm starte ohnen die Port konfiguration ,und auf den mic lade , ist keine Reaktion an die Pins
2:
wenn ich die mein Programm mit der Port konfiguration compiliere ,kriege ich diese Meldung vom Copiler ( error C25 syntax error near 'sbit')

Ich will eigentlich nur das PWM verhalten an die Pins anschauen wenn ich die Periode andere oder die Count value von T12 .
Danke fuer jede Hilfe .
und so sieht mein Programm aus :

#include <XC167.h>

void main (void) {

//Port 1 konfiguration

sbit P1L_0 = P1L^0;// declare portpin to use

sbit DP1L_0 = DP1L^0;// declare direction bit to use

sbit P1L_1 = P1L^1;

sbit DP1L_1 = DP1L^1;

DP1L_0 = 1; //init Direction to output CC60

DP1L_1 = 1; //init Direction to output COUT60

//PWM Konfiguration

CCU6_TCTR0 = 0x0010; // T12 ist gestoppt
CCU6_TCTR4 = 0x0001; // T12 zaehlt nicht mehr

CCU6_T12 = 400; // Timer Wert mit dem es vergliechen wird
CCU6_T12PR = 800; //Die Periode der Timer
CCU6_TCTR4 = 0x0020 ; // Start der Timer

while(1){

CCU6_T12 = 400; // Timer Wert mit dem es vergliechen wird
CCU6_T12PR = 800; //Die Periode der Timer

}

} end of main

Parents
  • I had the first problem (there was a configuration of the target). Now I download my program without probleml on the chip.

    And, as you said. Not it works!
    What is the reason?
    I have the timer T12 Stopped
    So that I can given the frequency for T12
    I give the period
    Then I set the Output CC60 and COUT60
    Then i giving the Value to compared
    And finally , I started the timer T12

    Where I have because of the error or what I should not do what I have done?
    Thanks in advance

    Many thanks for your help

    ####################
    ####################
    //Programm
    sbit P1L_0 = P1L^0 ; // declare portpin to use
    sbit DP1L_0 = DP1L^0 ; // declare direction bit to use
    sbit P1L_1 = P1L^1 ;
    sbit DP1L_1 = DP1L^1 ;

    void main (void) {

    DP1L_0 = 1 ; //init Direction to output
    DP1L_1 = 1 ; //init Direction to output

    //PWM Konfiguration

    CCU6_TCTR0 = 0x0010 ; // T12 ist gestoppt

    CCU6_T12PR = 800; //Die Periode der Timer

    CCU6_TCTR0 = 0x0009; //T12PRE=1 und T12CLK=001
    CCU6_T12MSEL = 0x0003; //Compare output on pins COUT6x and CC6x.

    while(1) // endlosschleife

    {
    CCU6_T12 = 400; // Count value to compared
    CCU6_TCTR4 = 0x0002 ; // Start the Timer
    } }

Reply
  • I had the first problem (there was a configuration of the target). Now I download my program without probleml on the chip.

    And, as you said. Not it works!
    What is the reason?
    I have the timer T12 Stopped
    So that I can given the frequency for T12
    I give the period
    Then I set the Output CC60 and COUT60
    Then i giving the Value to compared
    And finally , I started the timer T12

    Where I have because of the error or what I should not do what I have done?
    Thanks in advance

    Many thanks for your help

    ####################
    ####################
    //Programm
    sbit P1L_0 = P1L^0 ; // declare portpin to use
    sbit DP1L_0 = DP1L^0 ; // declare direction bit to use
    sbit P1L_1 = P1L^1 ;
    sbit DP1L_1 = DP1L^1 ;

    void main (void) {

    DP1L_0 = 1 ; //init Direction to output
    DP1L_1 = 1 ; //init Direction to output

    //PWM Konfiguration

    CCU6_TCTR0 = 0x0010 ; // T12 ist gestoppt

    CCU6_T12PR = 800; //Die Periode der Timer

    CCU6_TCTR0 = 0x0009; //T12PRE=1 und T12CLK=001
    CCU6_T12MSEL = 0x0003; //Compare output on pins COUT6x and CC6x.

    while(1) // endlosschleife

    {
    CCU6_T12 = 400; // Count value to compared
    CCU6_TCTR4 = 0x0002 ; // Start the Timer
    } }

Children
  • As I mentioned before, I never used XC167.
    Just my (last) 2 cent:

    P1 could be already used for the 8/16 bit demux bus.
    Couldn't that be a problem?

    You are loading and starting the timer again and again and again...

    Before downloading your application to flash and hoping it runs you should first simulate it.