/Designs/dum/SW/2patra/1np/main.c
0,0 → 1,192
#include "main.h"
 
#case
 
#define S105A1 input(PIN_A0)
#define R105A1U input(PIN_A1)
#define R105A1D input(PIN_A2)
#define S104A1 input(PIN_A3)
#define R104A1U input(PIN_A4)
#define R104A1D input(PIN_A5)
#define R104B1U input(PIN_A6)
#define R104B1D input(PIN_A7)
 
#define S103A1 input(PIN_B0)
#define S103A2 input(PIN_B1)
#define S103A3 input(PIN_B2)
#define R103A1U input(PIN_B3)
#define R103A1D input(PIN_B4)
#define S106A1 input(PIN_B5)
#define S107A2 input(PIN_B6)
#define S109A1 input(PIN_B7)
 
#define OS101 PIN_C0
#define OS105B PIN_C1
#define OS105C PIN_C2
 
//#define PIN_C3 31763
//#define PIN_C4 31764
//#define PIN_C5 31765
 
//#define PIN_C6 31766 //TX
//#define PIN_C7 31767 //RX
 
#define S101A1 input(PIN_D0)
#define S101A2 input(PIN_D1)
#define S105B1 input(PIN_D2)
#define S105C1 input(PIN_D3)
#define S105D1 input(PIN_D4)
#define S102A1 input(PIN_D5)
#define S110A1 input(PIN_D6)
#define S108A1 input(PIN_D7)
 
/*
#define PIN_E0 31776
#define PIN_E1 31777
#define PIN_E2 31778
#define PIN_E3 31779
#define PIN_E4 31780
#define PIN_E5 31781
#define PIN_E6 31782
#define PIN_E7 31783
 
#define PIN_F0 31784
#define PIN_F1 31785
#define PIN_F2 31786
#define PIN_F3 31787
#define PIN_F4 31788
#define PIN_F5 31789
#define PIN_F6 31790
#define PIN_F7 31791
 
#define PIN_G0 31792
#define PIN_G1 31793
#define PIN_G2 31794
#define PIN_G3 31795
#define PIN_G4 31796
#define PIN_G5 31797
 
#define PIN_H0 31800
#define PIN_H1 31801
#define PIN_H2 31802
#define PIN_H3 31803
#define PIN_H4 31804
#define PIN_H5 31805
#define PIN_H6 31806
#define PIN_H7 31807
 
#define PIN_J0 31808
#define PIN_J1 31809
#define PIN_J2 31810
#define PIN_J3 31811
#define PIN_J4 31812
#define PIN_J5 31813
#define PIN_J6 31814
#define PIN_J7 31815
*/
 
#define LED1 PIN_J7
#define LED2 PIN_J6
 
int1 s105A1;
int1 r105A1U;
int1 r105A1D;
int1 s104A1;
int1 r104A1U;
int1 r104A1D;
int1 r104B1U;
int1 r104B1D;
 
int1 s103A1;
int1 s103A2;
int1 s103A3;
int1 r103A1U;
int1 r103A1D;
int1 s106A1;
int1 s107A2;
int1 s109A1;
 
int1 s101A1;
int1 s101A2;
int1 s105D1;
int1 s102A1;
int1 s110A1;
int1 s108A1;
 
void main()
{
 
setup_adc_ports(NO_ANALOGS|VSS_VDD);
setup_adc(ADC_CLOCK_DIV_2);
setup_psp(PSP_DISABLED);
setup_spi(SPI_SS_DISABLED);
setup_wdt(WDT_OFF);
setup_timer_0(RTCC_INTERNAL);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
setup_ccp1(CCP_OFF);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
 
s105A1=S105A1;
r105A1U=R105A1U;
r105A1D=R105A1D;
s104A1=S104A1;
r104A1U=R104A1U;
r104A1D=R104A1D;
r104B1U=R104B1U;
r104B1D=R104B1D;
s103A1=S103A1;
s103A2=S103A2;
s103A3=S103A3;
r103A1U=R103A1U;
r103A1D=R103A1D;
s106A1=S106A1;
s107A2=S107A2;
s109A1=S109A1;
s101A1=S101A1;
s101A2=S101A2;
s105D1=S105D1;
s102A1=S102A1;
s110A1=S110A1;
s108A1=S108A1;
 
while(TRUE)
{
if(s105A1!=S105A1) {s105A1=S105A1; printf("S15A");}
if(r105A1U!=R105A1U) {r105A1U=R105A1U; printf("R15AU");}
if(r105A1D!=R105A1D) {r105A1D=R105A1D; printf("R15AD");}
if(!S105B1) {output_low(OS105B);} else {output_high(OS105B);}
if(!S105C1) {output_low(OS105C);} else {output_high(OS105C);}
if(s105D1!=S105D1) {s105D1=S105D1; printf("S15D");}
if(s104A1!=S104A1) {s104A1=S104A1; printf("S14A");}
if(r104A1U!=R104A1U) {r104A1U=R104A1U; printf("R14AU");}
if(r104A1D!=R104A1D) {r104A1D=R104A1D; printf("R14AD");}
if(r104B1U!=R104B1U) {r104B1U=R104B1U; printf("R14BU");}
if(r104B1D!=R104B1D) {r104B1D=R104B1D; printf("R14BD");}
if(s103A1!=S103A1) {s103A1=S103A1; printf("S13A");}
if(s103A2!=S103A2) {s103A2=S103A2; printf("S13A");}
if(s103A3!=S103A3) {s103A3=S103A3; printf("S13A");}
if(r103A1U!=R103A1U) {r103A1U=R103A1U; printf("R13AU");}
if(r103A1D!=R103A1D) {r103A1D=R103A1D; printf("R13AD");}
if(s106A1!=S106A1) {s106A1=S106A1; printf("S16A");}
if(s107A2!=S107A2) {s107A2=S107A2; printf("S17A");}
if(s109A1!=S109A1) {s109A1=S109A1; printf("S19A");}
if(s101A1!=S101A1) {s101A1=S101A1; printf("S11A");}
if(s101A2!=S101A2) {s101A2=S101A2; printf("S11A");}
if(s102A1!=S102A1) {s102A1=S102A1; printf("S12A");}
if(s110A1!=S110A1) {s110A1=S110A1; printf("S1aA");}
if(s108A1!=S108A1) {s108A1=S108A1; printf("S18A");}
 
output_toggle(LED1);
delay_ms(100);
}
}
/Designs/dum/SW/2patra/1np/main.h
0,0 → 1,25
#include <18F8310.h>
#device adc=8
 
#FUSES NOWDT //No Watch Dog Timer
#FUSES WDT128 //Watch Dog Timer uses 1:128 Postscale
#FUSES INTRC_IO //Internal RC Osc, no CLKOUT
#FUSES NOBROWNOUT //No brownout reset
#FUSES BORV46 //Brownout reset at 4.6V
#FUSES PUT //Power Up Timer
#FUSES BW16 //16-bit external bus mode
#FUSES STVREN //Stack full/underflow will cause reset
#FUSES NODEBUG //No Debug mode for ICD
#FUSES IESO //Internal External Switch Over mode enabled
#FUSES NOFCMEN //Fail-safe clock monitor enabled
#FUSES NOXINST //Extended set extension and Indexed Addressing mode disabled (Legacy mode)
#FUSES NOWAIT //Wait selections unavailable for Table Reads or Table Writes
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOEBTR //Memory not protected from table reads
#FUSES LPT1OSC //Timer1 configured for low-power operation
#FUSES NOMCLR //Master Clear pin enabled
#FUSES MCU //Microcontroller Mode
 
#use delay(clock=1000000)
#use rs232(baud=19200,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)
 
/Designs/dum/SW/2patra/1np/main.pjt
0,0 → 1,30
[PROJECT]
Target=C:\Users\kakl\Documents\MLAB\Designs\dum\SW\2patra\1np\main.hex
Development_Mode=
Processor_Text=PIC18F8310
ToolSuite=CCS
Processor=0x8310
[C:\Users\kakl\Documents\MLAB\Designs\dum\SW\2patra\1np\main]
Type=4
Path=
FileList=
BuildTool=
OptionString=
AdditionalOptionString=
[mru-list]
1=C:\Users\kakl\Documents\MLAB\Designs\dum\SW\2patra\1np\main.c
[Windows]
0=0000 %S 0 0 796 451 3 0
[Units]
Link=0
Count=1
1=C:\Users\kakl\Documents\MLAB\Designs\dum\SW\2patra\1np\main
[Opened Files]
1=main.c
2=main.h
3=..\..\..\..\..\..\..\..\..\Program Files\PICC\Devices\18F8310.h
4=..\..\simple\main.c
5=
6=..\..\..\..\..\Modules\PIC\PIC18F8xTQ8001A\SW\PIC18F8310\blik.h
7=..\..\..\..\..\Modules\PIC\PIC18F8xTQ8001A\SW\PIC18F8310\blik.c
8=
/Designs/dum/SW/2patra/2np/main.c
0,0 → 1,208
#include "main.h"
 
#case
 
#define S105A PIN_A0
#define R105AU PIN_A1
#define R105AD PIN_A2
#define S104A PIN_A3
#define R104AU PIN_A4
#define R104AD PIN_A5
#define R104BU PIN_A6
#define R104BD PIN_A7
 
#define S103A PIN_B0
#define R103AU PIN_B1
#define R103AD PIN_B2
#define S106A PIN_B3
#define S107A PIN_B4
#define S109A PIN_B5
 
//#define OS101 PIN_C0
//#define OS105B PIN_C1
//#define OS105C PIN_C2
//#define PIN_C3 31763
//#define PIN_C4 31764
//#define PIN_C5 31765
 
//#define PIN_C6 31766 //TX
//#define PIN_C7 31767 //RX
 
#define S101A PIN_D0
#define S105D PIN_D1
#define S102A PIN_D2
#define S110C PIN_D3
#define S108A PIN_D4
#define S201A PIN_D5
#define S110B PIN_D6
 
/*
#define PIN_E0 31776
#define PIN_E1 31777
#define PIN_E2 31778
#define PIN_E3 31779
#define PIN_E4 31780
#define PIN_E5 31781
#define PIN_E6 31782
#define PIN_E7 31783
 
#define PIN_F0 31784
#define PIN_F1 31785
#define PIN_F2 31786
#define PIN_F3 31787
#define PIN_F4 31788
#define PIN_F5 31789
#define PIN_F6 31790
#define PIN_F7 31791
 
#define PIN_G0 31792
#define PIN_G1 31793
#define PIN_G2 31794
#define PIN_G3 31795
#define PIN_G4 31796
#define PIN_G5 31797
 
#define PIN_H0 31800
#define PIN_H1 31801
#define PIN_H2 31802
#define PIN_H3 31803
#define PIN_H4 31804
#define PIN_H5 31805
#define PIN_H6 31806
#define PIN_H7 31807
 
#define PIN_J0 31808
#define PIN_J1 31809
#define PIN_J2 31810
#define PIN_J3 31811
#define PIN_J4 31812
#define PIN_J5 31813
#define PIN_J6 31814
#define PIN_J7 31815
*/
 
#define LED1 PIN_J7
#define LED2 PIN_J6
 
#define ON(port) output_low(port);
#define OFF(port) output_high(port);
 
typedef enum {UP, DOWN, NOTHING} request;
 
void main()
{
char c;
if(restart_cause()!= WDT_TIMEOUT)
{
setup_adc_ports(NO_ANALOGS|VSS_VDD);
setup_adc(ADC_CLOCK_DIV_2);
setup_psp(PSP_DISABLED);
setup_spi(SPI_SS_DISABLED);
setup_wdt(WDT_ON);
setup_timer_0(RTCC_INTERNAL);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
setup_ccp1(CCP_OFF);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
OFF(S105A);
OFF(R105AU);
OFF(R105AD);
OFF(S104A);
OFF(R104AU);
OFF(R104AD);
OFF(R104BU);
OFF(R104BD);
OFF(S103A);
OFF(R103AU);
OFF(R103AD);
OFF(S106A);
OFF(S107A);
OFF(S109A);
OFF(S101A);
OFF(S105D);
OFF(S102A);
OFF(S110C);
OFF(S108A);
OFF(S201A);
OFF(S110B);
}
while(TRUE)
{
if(kbhit())
{
c=getc();
if(c=='S')
{
getc();
switch(getc())
{
case '1':
output_toggle(S101A);
break;
case '2':
output_toggle(S102A);
break;
case '3':
output_toggle(S103A);
break;
case '4':
output_toggle(S104A);
break;
case '5':
c=getc();
if(c=='A') {output_toggle(S105A);}
if(c=='D') {output_toggle(S105D);}
break;
case '6':
output_toggle(S106A);
break;
case '7':
output_toggle(S107A);
break;
case '8':
output_toggle(S108A);
break;
case '9':
output_toggle(S109A);
break;
case 'a':
output_toggle(S110B);
output_toggle(S110C);
break;
}
}
if(c=='R')
{
getc();
switch(getc())
{
case '3':
getc();
c=getc();
if((c=='U')) {};
break;
case '4':
c=getc();
if(c=='A') {};
if(c=='B') {};
break;
case '5':
getc();
getc();
break;
}
}
output_toggle(LED1);
}
else
{
restart_wdt();
}
}
}
/Designs/dum/SW/2patra/2np/main.h
0,0 → 1,25
#include <18F8310.h>
#device adc=8
 
#FUSES WDT //No Watch Dog Timer
#FUSES WDT16 //Watch Dog Timer uses 1:16 Postscale
#FUSES INTRC_IO //Internal RC Osc, no CLKOUT
#FUSES NOBROWNOUT //No brownout reset
#FUSES BORV46 //Brownout reset at 4.6V
#FUSES PUT //Power Up Timer
#FUSES BW16 //16-bit external bus mode
#FUSES STVREN //Stack full/underflow will cause reset
#FUSES NODEBUG //No Debug mode for ICD
#FUSES IESO //Internal External Switch Over mode enabled
#FUSES NOFCMEN //Fail-safe clock monitor enabled
#FUSES NOXINST //Extended set extension and Indexed Addressing mode disabled (Legacy mode)
#FUSES NOWAIT //Wait selections unavailable for Table Reads or Table Writes
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOEBTR //Memory not protected from table reads
#FUSES LPT1OSC //Timer1 configured for low-power operation
#FUSES NOMCLR //Master Clear pin enabled
#FUSES MCU //Microcontroller Mode
 
#use delay(clock=1000000)
#use rs232(baud=19200,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)
 
/Designs/dum/SW/2patra/2np/main.pjt
0,0 → 1,52
[Directories]
Include=C:\Program Files\PICC\Devices;C:\Program Files\PICC\Drivers;
Library=
LinkerScript=
[defines]
enabled=0
D1=
V1=
[fileformats]
forcecoff=0
debug=4
error=2
object=0
list=0
scratch=0
sta=1
tre=1
allerrors=1
allwarnings=1
stayupne=3
stayupoe=0
[PROJECT]
Target=main.hex
Development_Mode=
Processor=0x8310
Processor_Text=PIC18F8310
ToolSuite=CCS
[Target Data]
BuildTool=C-COMPILER
OptionString=+FH
AdditionalOptionString=
BuildRequired=1
[main.c]
Type=4
Path=
FileList=
BuildTool=
OptionString=
AdditionalOptionString=
[mru-list]
1=main.c
[Windows]
0=0000 %S 0 0 796 451 3 0
[Units]
Link=0
Count=1
1=main.c
[Opened Files]
1=main.c
2=main.h
3=..\..\..\..\..\..\..\..\..\Program Files\PICC\Devices\18F8310.h
4=