Hello,
I have the below code and I'm having some issues. Only ms1 changes state when I change the port output from logic high to logic low or the other way around.
For ms2 when I have the output set to logic low the DMM reads 10mV. When I set the logic output of ms2 to high the DMM reads 60mV. The pins are not connected to anything right now and the chip is running ok so far on other ports, I'm running a stepper motor with it and driving a couple of LEDs, but the ms2 pin has issues?
Not sure if my configuration bits are incorrect, but I can't get this running as it's supposed to right now. Any help will be appreciated.
I have the below code and I'm having some issues. Only ms1 changes state when I change the port output from logic high to logic low or the other way around.
For ms2 when I have the output set to logic low the DMM reads 10mV. When I set the logic output of ms2 to high the DMM reads 60mV. The pins are not connected to anything right now and the chip is running ok so far on other ports, I'm running a stepper motor with it and driving a couple of LEDs, but the ms2 pin has issues?
Not sure if my configuration bits are incorrect, but I can't get this running as it's supposed to right now. Any help will be appreciated.
Code:
#define FCY 8000000UL
#include <P24FJ64GB002.h>
#include <libpic30.h>
_CONFIG1( FWDTEN_OFF & ICS_PGx1 & GWRP_OFF & GCP_OFF & GWRP_OFF & JTAGEN_OFF)
_CONFIG2( POSCMOD_NONE & I2C1SEL_PRI & IOL1WAY_ON & OSCIOFNC_ON & FCKSM_CSDCMD & FNOSC_FRC & PLL96MHZ_OFF & IESO_OFF)
_CONFIG3(SOSCSEL_IO) //Fast Internal RC (FRC) Oscillator 8MHz Clock Source
//Defines
#define ms1 LATBbits.LATB7
#define ms2 LATBbits.LATB8
main ()
{
TRISBbits.TRISB7 = 0;
TRISBbits.TRISB8 = 0;
AD1PCFG = 0xFFFF; //All pins are digital
//Output Ports
TRISBbits.TRISB7 = 0; //Set ms1 port as output
TRISBbits.TRISB8 = 0; //Set ms2 port as output
//Output ports initial states
ms1 = 0;
ms2 = 0;
while (1)
{
ms1 = 1;
ms2 = 1;
}//endWhile }