Who is Chuck and what does his code look like?
Please post your code so we can tell what is going on.
Neither one of those files you mentioned should be included in your code. PIC Basic takes care of that.
Who is Chuck and what does his code look like?
Please post your code so we can tell what is going on.
Neither one of those files you mentioned should be included in your code. PIC Basic takes care of that.
Dave
Always wear safety glasses while programming.
' RA2 Pot connection
' RB4 LED4
' RB3 LED3
' RB2 LED2
' RB1 LED1
' RB0 LED0
'-------------------- Revision History ----------------------------------------
include "pbppic14.lib"
include "16F877.bas"
'-------------------- Constants and Defines -----------------------------------
'Define ACDIN parameters
Define ADC_BITS 8 ' Set number of bits in result
DEFINE ADC_CLOCK 3 ' Set clock source ( 3 = RC )
DEFINE ADC_SAMPLEUS 50 ' Set sampling time to micro-seconds
'-------------------- Variables -----------------------------------------------
adval var byte ' Create adval to store result
PortB = %00000000 ' All outputs off to start
TrisB = %00000000 ' All of PortB is Outputs
MAIN:
TRISA = %00111111 ' Set PortA to all Inputs
ADCON1 = %00000010 ' Set PortA Analogue
LOOP:
ADCIN 2, adval ' Read channel to Adval
'******************* Let's Drive some LEDS ************************************
Ledtst1:
if adval > 25 tHEN tst2 ' If A/D val is less than 25 then
PortB = %0000001 ' light LED0 only
goto cont ' Continue with Programme
tst2:
if adval > 75 then tst3 ' If A/D val is between 25 - 75
PortB = %00000011 ' light LED0 - LED1 only
goto cont ' Continue with Programme
tst3:
if adval > 125 then tst4 ' If A/D val is between 75 - 125
PortB = %00000111 ' light LED0 - LED2 only
Goto cont ' Continue with Programme
tst4:
if adval = 175 then tst5 ' If A/D val is between 125 - 175
PortB = %00001111 ' light LED0 - LED3 only
goto cont ' Continue with Programme
tst5:
PortB = %00011111 ' If A/D value is greater than 175
' Then light all LEDS0 - 4
cont:
Pause 100 ' wiat 1 second
goto LOOP ' Go back to LOOP
end
I commented out these two lines
and the rest of your code compiled here. Give it a try. I will look at the remainder in a bit.Code:include "pbppic14.lib" include "16F877.bas"
Dave
Always wear safety glasses while programming.
I originally included the two files because without them the compilation errors are...
'Macro label?L not found in macro file' , 'Macro ADCIN?CN not found in macro file', etc. for all the commands used in this programme..I am beginning to think that my last update of MicroCodePlus Studio may be crappy, although it compiles 16F84A's OK.I may have to look at reinstalling this programme ...Thanks ..Rod.
Do you have MCS set up to us MPASM? Should not make a difference with you PIC though.
The machine I tested your code on does not have MCS. I used MPLAB.
What version of PIC BASIC PRO and MCS do you have?
Dave
Always wear safety glasses while programming.
I am only using MCS 3.0.0.5 as standalone , and PICBasicPro 2.45A. I do have Mplab V8.0 onboard but they no longer include the ability to compile from basic , and will only work with the *.asm file. If this programme compiles on your system , then it should compile on mine , unless I have a dodgy software loading.. I am about to remove PicBasicPro and MCS and reload them both.. I will post the results , most probably Monday....Thanks...Rod.
This tells how to use PIC BASIC and MPLAB together.
http://www.melabs.com/support/mplab.htm
Works very well. I even use this on my Linux box.
Dave
Always wear safety glasses while programming.
Bookmarks