PICSim
0.8.1
PICsim - PIC Simulator
|
Go to the documentation of this file.
68 #include"p16fxxx_defs.h"
69 #include"p16fxxxe_defs.h"
70 #include"p18fxxx_defs.h"
73 #define BUFFMAX 8192 //4K word
102 unsigned char txtemp[2];
104 unsigned char RCREG2;
106 char SERIALDEVICE[100];
107 unsigned int serialbaud;
118 unsigned char buff[BUFFMAX];
120 unsigned char * serial_TXSTA;
121 unsigned char * serial_PIR;
122 unsigned char * serial_PIE;
123 unsigned char RXIF_mask;
124 unsigned char TXIF_mask;
125 unsigned char * serial_RCSTA;
126 unsigned char * serial_SPBRG;
127 unsigned char * serial_RCREG;
128 unsigned char * serial_TXREG;
129 unsigned short serial_TXREG_ADDR;
130 unsigned short serial_RCSTA_ADDR;
131 unsigned short serial_RCREG_ADDR;
132 unsigned char * serial_TRIS_RX;
133 unsigned char serial_TRIS_RX_MASK;
150 #define PT_ANALOG 0x04
151 #define PT_ANAREF 0x05
152 #define PT_USART 0x06
169 #define P16F84A 0x0560
179 #define P16F777 0x0DE0
186 #define P16F18855 0X306C
193 #define P18F452 0x0420
208 #define CFG_MCLR 0x01
210 #define CFG_DEBUG 0x04
211 #define CFG_WDT_DIV 0x08
235 extern unsigned char NO_IO[6];
238 #define P_VDD &NO_IO[0]
239 #define P_VSS &NO_IO[1]
240 #define P_RST &NO_IO[2]
241 #define P_OSC &NO_IO[3]
242 #define P_USB &NO_IO[4]
243 #define P_NC &NO_IO[5]
252 unsigned int RAMSIZE;
253 unsigned int ROMSIZE;
254 unsigned int EEPROMSIZE;
256 unsigned int CONFIGSIZE;
257 unsigned char STACKSIZE;
258 unsigned char PINCOUNT;
259 unsigned char CCPCOUNT;
260 unsigned char ADCCOUNT;
261 unsigned char USARTCOUNT;
262 unsigned char WDT_MS;
265 unsigned short debugv[8];
267 unsigned short *prog;
269 unsigned char *eeprom;
270 unsigned short *config;
286 unsigned char *usart_rx;
287 unsigned char *usart_tx;
297 unsigned char ocd_pgca;
298 unsigned char ocd_pgc;
312 unsigned char t0cki_;
313 unsigned char t1cki_;
323 unsigned char portbm;
326 unsigned char adcon1;
332 unsigned char p16latch[5];
344 unsigned char ssp_ck;
345 unsigned char ssp_sck;
346 unsigned char ssp_scka;
348 unsigned char ssp_bit;
354 int (*getconf)(
unsigned int);
355 void (*periferic)(void);
356 int (*interrupt)(void);
382 int pic_set_serial(
_pic * pic_,
int nser ,
const char * name,
int flowcontrol,
int ctspin,
int rtspin);
396 int pic_init(
_pic * pic_,
int processor,
const char * fname,
int leeprom,
float freq);
649 #define sfr_addr(fsr) (fsr - pic->ram)
654 unsigned char family;
655 void (*start) (void);
662 extern int PIC_count;
664 #define init_pic(function, family, ID) \
665 static pic_desc desc_ ## function = { ID , #function , family , function ## _start };\
666 static void __attribute__((constructor)) init_ ## function(void);\
667 static void init_ ## function (void){ \
668 pic_register(desc_ ## function);}
unsigned char pic_get_pin_DOV(unsigned char pin)
Get Default Open Value of one pin (external PULL UP)
unsigned char pic_get_pin_dir(unsigned char pin)
Get dir of one pin.
int pic_set_apin(unsigned char pin, float value)
Set digital value of one pin.
void pic_erase_flash(void)
erase the microcontroller FLASH
unsigned char ptype
pin types
Definition: picsim.h:81
PICsim P16E memory map structure.
Definition: p16fxxxe_defs.h:41
float avalue
analog input value
Definition: picsim.h:87
const char * getFSRname_18(unsigned int addr)
Return P18 FSR name by address.
void pic_step(void)
Execute one simulation step.
int write_ihx18(const char *fname)
Dump all non volatile P18 microcontroller memory to HEX file.
PICsim P18 memory map structure.
Definition: p18fxxx_defs.h:35
unsigned char lvalue
latch value
Definition: picsim.h:84
PICsim PIC structure.
Definition: picsim.h:250
PICsim P16 memory map structure.
Definition: p16fxxx_defs.h:35
int read_ihx_16e(const char *fname, int leeprom)
Read HEX file to P16E microcontroller.
int pic_set_pin_DOV(unsigned char pin, unsigned char value)
Set Default Open Value of one pin (external PULL UP)
unsigned int processor
procid
Definition: picsim.h:264
const char * getFSRname_16E2(unsigned int addr)
Return P16E2 FSR name by address.
unsigned int getprocbyname(const char *str)
Return processor ID by name.
const char * getPinName(_pic *pic, int pin, char *pname)
Return pin name.
unsigned char dir
pin dir
Definition: picsim.h:82
void pic_end(void)
finalize and free pic object internal memory
unsigned char family
pic family
Definition: picsim.h:263
unsigned char value
value
Definition: picsim.h:83
char * getnamebyproc(int proc, char *str)
Return processor name by ID.
const char * getFSRname_16(unsigned int addr)
Return P16 FSR name by address.
unsigned char print
print information ON/OFF
Definition: picsim.h:251
unsigned short rram
readed register
Definition: picsim.h:274
int pic_set_pin(unsigned char pin, unsigned char value)
Set digital value of one pin.
float oavalue
analog output value
Definition: picsim.h:89
PICsim serial structure.
Definition: picsim.h:97
float freq
frequency
Definition: picsim.h:279
unsigned char sleep
sleep mode on
Definition: picsim.h:280
int read_ihx(const char *fname, int leeprom)
Read HEX file to P16 microcontroller.
unsigned char * port
port address
Definition: picsim.h:86
const char * getFSRname_16E(unsigned int addr)
Return P16E FSR name by address.
int pic_icsp18(void)
Run P18 ICSP (must be pooling)
PICsim pin structure.
Definition: picsim.h:80
unsigned char pkg
packaging type
Definition: picsim.h:281
unsigned char ovalue
defaut open pin value
Definition: picsim.h:88
unsigned char pic_get_pin(unsigned char pin)
Get digital value of one pin.
unsigned short lram
loaded register
Definition: picsim.h:273
char pord
pin port number
Definition: picsim.h:85
int pic_init(_pic *pic_, int processor, const char *fname, int leeprom, float freq)
Initialize one pic object.
int pic_set_serial(_pic *pic_, int nser, const char *name, int flowcontrol, int ctspin, int rtspin)
Configure the serial port connection.
int getproclist(char list[][30], int size)
Return list name of supported processors
int pic_reset(int flags)
Reset the microcontroller.
void pic_icsp_init18(void)
Initialize P18 ICSP support.
int pic_icsp(void)
Run P16 ICSP (must be pooling)
int write_ihx(const char *fname)
Dump all non volatile P16 microcontroller memory to HEX file.
unsigned int getfprocbyname(const char *str)
Return processor family ID by name.
int write_ihx16e(const char *fname)
Dump all non volatile P16E microcontroller memory to HEX file.
int read_ihx_18(const char *fname, int leeprom)
Read HEX file to P18 microcontroller.
void pic_icsp_init(void)
Initialize P16 ICSP support.
unsigned char pic_get_pin_type(unsigned char pin)
Get type of one pin.
unsigned int getfprocbynumber(int proc)
Return processor family ID by ID.