hemnath
Advanced Member level 3
Code:
#include "18F2620.h"
#include "f2420_regs.h"
#fuses INTRC_IO, NOWDT,BROWNOUT,PUT
#use delay(clock=4000000)
#define RS PIN_A2
#define EN PIN_A1
#define CS PIN_C0
void main()
{
TRISB=0; // PORTB is configured as an output port
TRISC=0; // PORTC is configured as an output port
PORTC=0;
PORTB=0;
delay_ms(100);
SSPSTAT=0xC0; //Status Register SSPSTAT=11000000
SSPCON1 = 0b00100000;
output_high(CS);
delay_ms(1000);
while(1)
{
output_low(CS);
SSPBUF=100; // sending the lower 8 bits serially
while(!BF); // wait until the lower 8 bits are sent
SSPBUF=100; // sending the lower 8 bits serially
while(!BF); // wait until the lower 8 bits are sent
output_high(CS);
delay_ms(100);
}
}
Output voltage is always zero. Please help