mrcube_ns
Advanced Member level 1
- Joined
- Apr 10, 2002
- Messages
- 452
- Helped
- 48
- Reputation
- 96
- Reaction score
- 34
- Trophy points
- 1,308
- Location
- Europe
- Activity points
- 3,813
Strange PIC behavior
Here some small test in Hi te ch Pi cc mcu is 16f628.
Here is code:
#include <pic.h>
//#include <pic1662x.h>
#define PORTBIT(adr, bit) ((unsigned)(&adr)*8+(bit))
//__CONFIG(CP1|CP0|CPD|FOSC2|FOSC0|WDTE);
static bit test @ PORTBIT(PORTB, 1);
unsigned int i;
void main (void)
{
TRISA = 0;
TRISB = 0;
PCON = 0xFF;
OPTION=0x40;
INTCON=0x90;
PORTA = 255;
PORTB = 255;
test=1;
while(1){
if(test == 0)
test = 1;
else
test = 0;
for(i=0;i<10000;i++){
}//for
}//while
}//main
Here is what I see on oscilloscope on test pin non simetrical square signal :
___| |________________________| |_________________________
Any ideas?
Is it something wrong with code, am I doing something wrong???
Mr.Cube
Here some small test in Hi te ch Pi cc mcu is 16f628.
Here is code:
#include <pic.h>
//#include <pic1662x.h>
#define PORTBIT(adr, bit) ((unsigned)(&adr)*8+(bit))
//__CONFIG(CP1|CP0|CPD|FOSC2|FOSC0|WDTE);
static bit test @ PORTBIT(PORTB, 1);
unsigned int i;
void main (void)
{
TRISA = 0;
TRISB = 0;
PCON = 0xFF;
OPTION=0x40;
INTCON=0x90;
PORTA = 255;
PORTB = 255;
test=1;
while(1){
if(test == 0)
test = 1;
else
test = 0;
for(i=0;i<10000;i++){
}//for
}//while
}//main
Here is what I see on oscilloscope on test pin non simetrical square signal :
___| |________________________| |_________________________
Any ideas?
Is it something wrong with code, am I doing something wrong???
Mr.Cube