The first assignment I got a circuit to work with led's. The second assignment I had more trouble.
The lab assistant Thye helped me discover that I was using the wrong wire for my bread board.
I was using copper wire from the closet but everyone else uses another kind that is also in the closet
and easier to use. Once the board was wired I programmed the pic for the led's, but it did not work.
One led turned on once and never turned the others on. The lab monitor remembered that the quartz needed
to be called at the beginning of the code, which was not in the class example. We tried other things to
get it to work, but we couldn't find the problem.
I got the serial connection to work in the terminal window and I was able to see all my values
for my variable resistors. I could only get a maximum of 255 for a value. My variable was set to
word and 10 bit sampling, so I don't know why it happened that way. Can functions be called in
Pic Basic Pro? If statements can become pretty long without them.
Code:
DEFINE adc_bits 10
DEFINE adc_clock 3
DEFINE adc_samplus 20
ADCVar VAR WORD
trisa = %11111111
ADCON1 = %1000010
PAUSE 500
main:
ADCIN 0, ADCVar
SEROUT2 portc.6, 16468, [DEC ADCVar,13,10]
IF ADCVar>50 then
high portd.0
endif
If ADCVar<50 then
endif
Goto main