Close

Modifications for Windows Version (MINGW)

A project log for Microchip PIC Arduino based programmer

I love to program programmers. Yo dawg...

webwichtwebwicht 06/13/2016 at 19:312 Comments

For using the programmer (pp3.c) under Windows some minor changes:

1. Uncomment (or better replace) delay functions in sleet_ms()

2. Retrying ReadFile() if 0 bytes are read:

int getByte() 
{
	int ntotal=0;
	unsigned char buf[2];
	int n;
	do
	{
		ReadFile(port_handle, buf, 1, (LPDWORD)((void *)&n), NULL);
		ntotal++;
	} while(n==0 && ntotal<50);
	if (verbose>3)
		flsprintf(stdout,n<1?"RX: fail\n":"RX:  0x%02X\n", buf[0] & 0xFF);	
	if (n == 1)
		return buf[0] & 0xFF;
	comErr("Serial port failed to receive a byte, read returned %d\n", n);
	return -1; // never reached
}
3. Changes in InitSerialPort():
#if defined(__linux__)
strcpy(portname,"\\\\.\\");
#else
strcpy(portname,"");
#endif

Compiling with: gcc pp3.c -o pp3.exe

And here changes for PIC18f4622 CPU:

else if (strcmp("18f46k22",cpu)==0) 
		{
		flash_size = 32768; 
		page_size = 64; 
		devid_expected = 0x5400;
		devid_mask = 0xFFE0;
		chip_family = CF_P18F_A;
		}

Discussions

webwicht wrote 09/08/2016 at 20:34 point

Yes, programming worked for me.

  Are you sure? yes | no

jaromir.sukuba wrote 07/29/2016 at 11:36 point

@webwicht  did you actually try programming the PIC18F46K22?

  Are you sure? yes | no