ghostman11
Well-Known Member
i been playing aound with a shift register but so far have had no luck getting any output on it
i know the code is crappy at the mo but i was just trying to get a pin (any pin) set.
i am aware i probaly not given enough info but i cant think of what else i need to tell you soon as it pops back in my head i will post any details i have left out.
so from the scant info anyone got any cluse where i am going wrong?
i know the code is crappy at the mo but i was just trying to get a pin (any pin) set.
Code:
#pragma config OSC = IRCIO67, PWRT = OFF, WDT = OFF, MCLRE = ON, DEBUG = ON, LVP = OFF //..............Fuse stup
#include <p18f4685.h>
#include <stdio.h>
#include <delays.h>
#include <usart.h>
#include <adc.h>
#include "EEP.h"
#define reset LATDbits.LATD3 //storgae register reclear pin 10 on 595 clears the register
#define data_input LATDbits.LATD2 //pin 14 on 595 (ds) ser loads in the data if pin high 1 is loaded if low 0 is loaded
#define stclk LATDbits.LATD1 // pin 11 on 595 (shcp) clock pin toggle to load data in storage register clk
#define output_enable LATDbits.LATD4 // active low
#define latch LATDbits.LATD0//shift register clk
#define low =0;
#define high =1;
void main (void)
{
//sssssssssssssssssssssssssssssssssssssssssssssssssssss all the things we do once sssssssssssssssssssssss
// speed up the clock to 8MHz,18f4685
//OSCCONbits.IRCF0=1;
//OSCCONbits.IRCF1=1;
//OSCCONbits.IRCF2=1;
OSCCON = 0x70;
while(OSCCON & 0x02);
ADCON1=0x0A; //set up ADC
CMCON=0x07;
//stdout = _H_USER;
TRISBbits.TRISB2=1; //set switch 1 to input
TRISD=0x00;
output_enable=0;
reset=0;
latch=1;
latch=0;
LATDbits.LATD4=0;
while(1)
//ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
{
Nop();
output_enable=0;
data_input=1;
Nop();
stclk=1;
latch=1;
latch=0;
Nop();
stclk=0;
latch=1;
}
}
so from the scant info anyone got any cluse where i am going wrong?