Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
07/17/02 19:09
Read: times


 
#25947 - Why this program can't send out pulse
hi
i intend to do is to send out a pulse has 20ms period. 1ms high and 19ms low.

#include <c8051f000.h>
#include <stdio.h>
#include <intrins.h>
#define PWM 13

void main (void);
void wait(int units);

void main (void)
{

WDTCN=0xde; // disable the watchdog
WDTCN=0xad;

OSCICN = 0x04; // set SYSCLK to 2MHz
OSCXCN= 0x00; // disable external clock

TCON=0x10; //TR0=1;
TMOD=0x02; //set time 1 to 8bit auto load
CKCON=0x08; //use system clock

TL0=100; //from 100 count to 256, and gener.
TH0=100; // an signal to trigger PCA
// period=20ms

PRT0CF=0x08; //p0.3 push pull


PCA0CN = 0x40; // enable PCA counter
PCA0MD = 0x04;// timer 0 over flow, as time source

PCA0CPM1=0x42;// PWM

PCA0CPH1=PWM; //set pulse width high=1.5ms
PCA0CPL1=PWM;

XBR0=0x14;
//XBR1=0x04; //enable /INTO
XBR2=0x40; //crossbar enable

wait(20000);

}//colse main

i have test the pin on p0.3 which is constant
please tell me where i did wrong.

List of 2 messages in thread
TopicAuthorDate
Why this program can't send out pulse            01/01/70 00:00      
RE: Why this program can't send out pulse            01/01/70 00:00      

Back to Subject List