79#include "bitbang_uart.h"
80#include "p16fxxx_defs.h"
81#include "p16fxxxe_defs.h"
82#include "p18fxxx_defs.h"
128 unsigned char txtemp[2];
130 unsigned char RCREG2;
132 char SERIALDEVICE[100];
133 unsigned int serialbaud;
144 unsigned char buff[BUFFMAX];
146 unsigned char *serial_TXSTA;
147 unsigned char *serial_PIR;
148 unsigned char *serial_PIE;
149 unsigned char RXIF_mask;
150 unsigned char TXIF_mask;
151 unsigned char *serial_RCSTA;
152 unsigned char *serial_SPBRG;
153 unsigned char *serial_SPBRGH;
154 unsigned char *serial_BAUDCTL;
155 unsigned char *serial_RCREG;
156 unsigned char *serial_TXREG;
157 unsigned short serial_TXREG_ADDR;
158 unsigned short serial_RCSTA_ADDR;
159 unsigned short serial_RCREG_ADDR;
160 unsigned char *serial_TRIS_RX;
161 unsigned char serial_TRIS_RX_MASK;
178#define PT_DIGITAL 0x01
179#define PT_ANALOG 0x04
180#define PT_ANAREF 0x05
198#define P16F84A 0x0560
208#define P16F777 0x0DE0
215#define P16F18855 0X306C
222#define P18F452 0x0420
239#define CFG_DEBUG 0x04
240#define CFG_WDT_DIV 0x08
263 extern unsigned char NO_IO[6];
266#define P_VDD &NO_IO[0]
267#define P_VSS &NO_IO[1]
268#define P_RST &NO_IO[2]
269#define P_OSC &NO_IO[3]
270#define P_USB &NO_IO[4]
271#define P_NC &NO_IO[5]
283 unsigned int RAMSIZE;
284 unsigned int ROMSIZE;
285 unsigned int EEPROMSIZE;
287 unsigned int CONFIGSIZE;
288 unsigned char STACKSIZE;
289 unsigned char PINCOUNT;
290 unsigned char CCPCOUNT;
291 unsigned char ADCCOUNT;
292 unsigned char USARTCOUNT;
293 unsigned char WDT_MS;
296 unsigned short debugv[8];
298 unsigned short *prog;
300 unsigned char *eeprom;
301 unsigned short *config;
310 unsigned long long cycles;
318 unsigned char *usart_rx;
319 unsigned char *usart_tx;
329 unsigned char ocd_pgca;
330 unsigned char ocd_pgc;
344 unsigned char t0cki_;
345 unsigned char t1cki_;
355 unsigned char portbm;
359 unsigned char adcon1;
365 unsigned char p16latch[5];
380 unsigned char ioupdated;
381 unsigned char port_mirror;
383 unsigned char ssp_ck;
384 unsigned char ssp_sck;
385 unsigned char ssp_scka;
387 unsigned char ssp_bit;
391 void (*reset)(
_pic *pic);
392 void (*mmap)(
_pic *pic);
393 int (*getconf)(
_pic *pic,
unsigned int);
394 void (*disable_debug)(
_pic *pic);
395 void (*periferic)(
_pic *pic);
396 int (*interrupt)(
_pic *pic);
397 void (*stop)(
_pic *pic);
421 int ctspin,
int rtspin);
435 int pic_init(
_pic *pic_,
int processor,
const char *fname,
int leeprom,
689#define sfr_addr(fsr) (fsr - pic->ram)
695 unsigned char family;
696 void (*start)(
_pic *pic);
702 extern int PIC_count;
704#define init_pic(function, family, ID) \
705 static pic_desc desc_##function = {ID, #function, family, function##_start}; \
706 static void __attribute__((constructor)) init_##function(void); \
707 static void init_##function(void) \
709 pic_register(desc_##function); \
void pic_icsp_init18(_pic *pic_)
Initialize P18 ICSP support.
unsigned int getfprocbynumber(int proc)
Return processor family ID by ID.
int pic_set_pin(_pic *pic_, unsigned char pin, unsigned char value)
Set digital value of one pin.
unsigned char pic_get_pin_dir(_pic *pic_, unsigned char pin)
Get dir of one pin.
int pic_init(_pic *pic_, int processor, const char *fname, int leeprom, float freq)
Initialize one pic object.
int pic_set_pin_DOV(_pic *pic_, unsigned char pin, unsigned char value)
Set Default Open Value of one pin (external PULL UP)
unsigned char pic_get_pin_type(_pic *pic_, unsigned char pin)
Get type of one pin.
const char * getFSRname_18(unsigned int addr)
Return P18 FSR name by address.
int read_ihx_18(_pic *pic_, const char *fname, int leeprom)
Read HEX file to P18 microcontroller.
int write_ihx(_pic *pic_, const char *fname)
Dump all non volatile P16 microcontroller memory to HEX file.
int pic_icsp(_pic *pic_)
Run P16 ICSP (must be pooling)
int write_ihx16e(_pic *pic_, const char *fname)
Dump all non volatile P16E microcontroller memory to HEX file.
unsigned int getfprocbyname(const char *str)
Return processor family ID by name.
void pic_end(_pic *pic_)
finalize and free pic object internal memory
const char * getPinName(_pic *pic, int pin, char *pname)
Return pin name.
int pic_icsp18(_pic *pic_)
Run P18 ICSP (must be pooling)
int read_ihx(_pic *pic_, const char *fname, int leeprom)
Read HEX file to P16 microcontroller.
unsigned char pic_get_pin(_pic *pic_, unsigned char pin)
Get digital value of one pin.
int pic_set_apin(_pic *pic_, unsigned char pin, float value)
Set digital value of one pin.
unsigned int getprocbyname(const char *str)
Return processor ID by name.
int pic_reset(_pic *pic_, int flags)
Reset the microcontroller.
const char * getFSRname_16E2(unsigned int addr)
Return P16E2 FSR name by address.
const char * getFSRname_16E(unsigned int addr)
Return P16E FSR name by address.
void pic_erase_flash(_pic *pic_)
erase the microcontroller FLASH
int getproclist(char list[][30], int size)
Return list name of supported processors.
int write_ihx18(_pic *pic_, const char *fname)
Dump all non volatile P18 microcontroller memory to HEX file.
void pic_step(_pic *pic_)
Execute one simulation step.
const char * getFSRname_16(unsigned int addr)
Return P16 FSR name by address.
char * getnamebyproc(int proc, char *str)
Return processor name by ID.
void pic_icsp_init(_pic *pic_)
Initialize P16 ICSP support.
int pic_set_serial(_pic *pic_, int nser, const char *name, int flowcontrol, int ctspin, int rtspin)
Configure the serial port connection.
int read_ihx_16e(_pic *pic_, const char *fname, int leeprom)
Read HEX file to P16E microcontroller.
unsigned char pic_get_pin_DOV(_pic *pic_, unsigned char pin)
Get Default Open Value of one pin (external PULL UP)
unsigned short lram
loaded register
Definition picsim.h:304
float vcc
Microcontroller VCC used by ADC.
Definition picsim.h:357
unsigned char sleep
sleep mode on
Definition picsim.h:312
float freq
frequency
Definition picsim.h:311
unsigned int processor
procid
Definition picsim.h:295
unsigned char print
print information ON/OFF
Definition picsim.h:282
unsigned char family
pic family
Definition picsim.h:294
unsigned short rram
readed register
Definition picsim.h:305
unsigned char pkg
packaging type
Definition picsim.h:313
PICsim serial structure.
Definition picsim.h:124
PICsim P16E memory map structure.
Definition p16fxxxe_defs.h:42
PICsim P16 memory map structure.
Definition p16fxxx_defs.h:35
PICsim P18 memory map structure.
Definition p18fxxx_defs.h:37
Definition bitbang_uart.h:35
PICsim pin structure.
Definition picsim.h:112
unsigned char pin
pin
Definition picsim.h:113
unsigned char cap_ps
capture pre scaler
Definition picsim.h:115
unsigned char ovalue
old value
Definition picsim.h:114
PICsim pin structure.
Definition picsim.h:93
unsigned char lvalue
latch value
Definition picsim.h:97
unsigned char ptype
pin types
Definition picsim.h:94
unsigned char lsvalue
last set value (used by open collector simulation)
Definition picsim.h:103
unsigned char value
value
Definition picsim.h:96
unsigned char dir
pin dir
Definition picsim.h:95
char pord
pin port number
Definition picsim.h:98
unsigned char * port
port address
Definition picsim.h:99
unsigned char ovalue
defaut open pin value
Definition picsim.h:101
float oavalue
analog output value
Definition picsim.h:102
float avalue
analog input value
Definition picsim.h:100