First off, I can't believe you're using a 12CE674
Well, if you must ...
Here's a few pointers.
1: ID locations don't matter. They don't have an effect on the processors functions.
2: Turn off the Analog pin functions.
ADCON1 = 7
3: Move factory calibration to OSCCAL
DEFINE OSCCAL_2K 1
4: For ease of use, put the Configs in your program.5: Initialize variables at the beginning of the program.Code:@ device INTRC_OSC ; Internal Oscillator @ device MCLR_OFF ; Turn OFF Master Clear Reset @ device WDT_OFF ; Turn OFF WatchDog Timer
Reasoning: When the program gets to Main:, the state of Memory_1 is not known.You can either set each variable to a specific value, or just put a CLEAR statement at the top of the program, and everything will start off at 0.Code:Main: if (Input_1=1 & Memory_1=0) then
6: Initialize your output states before setting TRISIO.
CLEAR does not initialize the PIN states. So you have to do those manually.HTH,Code:GPIO = 0 TRISIO = %111001





Bookmarks