Document Information

Document Title Product Review: A closer look at Factor
Document Number & Revision 402 - 0003 - 1.0
Release Date February 25, 2021
Documente Status Original Document, no ammendments
Where to buy

Lead in

FACTOR is a reprogrammable, multipurpose embedded system which enables integration with existing systems for monitoring, control and reporting.

NOTE: Factor is part of a larger family and series of products Delve, and Inuit


Factor is a systems solution that combines industrial level electrical isolation along with the required sensor integration. While factor comes with a PIC18F45K22, the 16F and 18F families share a similar pinout and this enables products and systems to be PIN compatiable. This allows for code to be deployed from a smaller device in pin count and features to a bigger device such as the PIC18F45K22.
You can replace the PIC18F45K22 with your device  of choice which may be a 16Fxx or 18Fxx device.

NOTE: The feaures below are a subset, please refer to the Microchip datasheet for more details.

The Feature Set

  • Device: #PIC18F45K22
  • Dual Power Supplies
    1. 3v3 and 5V0
    2. Jumper setting configures the PCB voltage
    3. PCB is voltage polarity reversal protected
  • Serial Communications
    1. PCB Connector: USB, Type B (Printer USB Cable)
    2. USB ->USART bridge: FT232
    3. Tracked to RC6 | RC7
    4. Supports Bootloader
  • Programming Methods
    1. ICSP interface, compatible with PICKIT 3 & PICKIT 4
    2. Bootloader
      1. Uses USB to USART interface
      2. NOTE: Bootloader installed
  • Software
    1. Mikroe Compiler or other suitable type
    2. Any Microchip compatiable software with produces a hex file
  • Hardware
    1. The PIC is supported by a robust platform enabling idustrial level or similar integration
    2. I/O are tracked to peripherals for ease of use.

Down to Code

Shown below is a simple code sample for a Hello World project example. The code demonstartes how to configure the PIC, run through a relay test and configure the LM35 in the VREF slot.

/* Sample Code (c) 20201 HavenTechnik OBJECTIVE: Tests elemements of Factor */ bit SysSet; bit Mikro; const unsigned long baud_rate [7]={9600,14400,19200,38400,56000,57600,115200}; unsigned char ch; unsigned int adc_rd; char *text; long tlong; char *tempc = "000.0"; int i; void LM35(); void flash(){ //LATB.B2 = ~LATB.B2; Delay_MS(1000); i=i++; if (i==6)i=0; } void SystemConfig(){ SysSet = 1; // Ports TRISA = 0x04; //A2D Disable ANSELA = 0x04; ANSELB = 0; ANSELC = 0; //ANSELD = 0; TRISB.B2 = 0; TRISB.B3 = 0; TRISB.B4 = 0; TRISB.B5 = 0; PORTB = 0x00; /* UART 1 Initialise for UART 1 for admin */ UART1_Init(baud_rate[6]); Delay_US(100); /* UART 2, Dedicated to Mikrobus */ if(Mikro ==1) { UART2_Init(115200); Delay_US(100); } INTCON = 0; // disable all interrupts } void LM35(){ adc_rd = ADC_read(2); // get ADC value from 2nd channel //LCD_Out(2,1,text); // print string a on LCD, 2nd row, 1st column tlong = (long)adc_rd * 5000; // covert adc reading to milivolts tlong = tlong / 1023; // 0..1023 -> 0-5000mV ch = tlong / 1000; // extract volts digit tempc[1] = ch+48; ch = (tlong / 100) % 10; // extract 0.1 volts digit //LCD_Chr_CP(48+ch); // write ASCII digit at cursor point tempc[2] = ch+48; ch = (tlong / 10) % 10; // extract 0.01 volts digit tempc[3] = ch+48; //ch = tlong % 10; // extract 0.001 volts digit tempc[4] = ch+48; UART1_Write(tempc[2]); UART1_Write(tempc[3]); UART1_Write_Text("."); UART1_Write(tempc[4]); UART1_Write(13); UART1_Write(10); Delay_ms(100); } void main() { SysSet = 0; i=0; SystemConfig(); while(1){ //if (!SysSet){ //} //LM35(); // If the input goes low, then the Relay Flashes flash(); switch(i) { case 1: LATB.B2 = 1;break; case 2: LATB.B2 = 0;LATB.B3 = 1;break; case 3: LATB.B3 = 0;LATB.B4 = 1;break; case 4: LATB.B4 = 0;LATB.B5 =1;break; case 5: LATB.B5 = 0; } } }

Why use Factor. . .

Factor utilizes one of Microchip's powerfull, energy efficient and extensbible devices. Prepopulated on Factor, it's a power up and play solution capable of running from a USB cable. The Device itself offers many itegrated peripherals namely: USART, I2C, SPI, PWM, CCP timers and so on. That's allot of techno jargon, but it equates to a compact purchase with many open doors for ongoing development; the device will allow you to grow your project to its full potential.