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
  • What I mean is this:

    #include <XC167.h>
    
    sbit P1L_0 = P1L^0;
    sbit DP1L_0 = DP1L^0;
    //and so on
    
    void main (void)
    {
       DP1L_0 = 1;
       //your code
    
    }
    

    I'm in doubt that your PWM will work, but I did not work with the XC167 (using P1 ?, instructions inside while(1) ?)

    If you post source code you should pay attention to the "Tips for posting messages"

Reply
  • What I mean is this:

    #include <XC167.h>
    
    sbit P1L_0 = P1L^0;
    sbit DP1L_0 = DP1L^0;
    //and so on
    
    void main (void)
    {
       DP1L_0 = 1;
       //your code
    
    }
    

    I'm in doubt that your PWM will work, but I did not work with the XC167 (using P1 ?, instructions inside while(1) ?)

    If you post source code you should pay attention to the "Tips for posting messages"

Children
  • Hello

    So I have the program now finally compiled, and error free.
    Now I have this problem:
    1:
    If I download the hex file with the Flash 3 beta Tolls on the MIC.
    Gives me an Error, "" The spicified Area is not blank "." Although I have the chip removed "erase chip." What is the reason?
    The target is to be set
    ROM 0x0 to 0x100000
    RAM 0x200000 to 0x80000

    2:
    Welsche problem you see in my program? What do you see is wrong with my program?

    Many thanks for your help

    ####################
    ####################
    //Programm

    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_TCTR4 = 0x0001 ; // T12 zählt nicht mehr

    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; // Timer Wert mit dem es vergliechen wird
    CCU6_TCTR4 = 0x0002 ; // Start der Timer
    } }

  • 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
    } }

  • 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.