xc8

initialise driver in C with xc8 compiler with gpio pins

一世执手 提交于 2019-12-14 04:01:34
问题 Lets say I have a driver "foo.h" and "foo.c" implementation. The driver interacts with the gpio pins on a microcontroller. In Arduino, each GPIO pin has it's own pin number (just an integer). Then you can initialise foo with the function initFoo(1) or initFoo(2), to choose the pin you want to use. In Mbed online c++ compiler, each GPIO can be controlled with a DigitalIn or DigitalOut object. In JAL (Just Another Language) that I'm also familiar with, they use the alias keyword. alias x is pin

Non-standard function return types: Fixing Splint parse error

随声附和 提交于 2019-12-14 02:40:42
问题 I'm using the embedded-system XC8 C compiler (for PIC microprocessors). The following is allowed: bit foo(){ //... } but being non-standard C, the Splint static analyser gives the following error: Parse Error: Non-function declaration: bit : "--------------------------------------" int. And the file/line of the error is the function prototype in the respective .h file. How can I fix this so Splint can analyse the rest of the file(s)? I think there might be two ways: I think I remember seeing

Why does this state machine not maintain its state?

不问归期 提交于 2019-12-11 03:54:12
问题 Hey there StackOverflow! In the following code I have a simple state machine that changes the operation of some external lighting device (as the comments imply). The state is changed via the pressing of the button connected to GP1. The circuit connected to GP1 is a comparator debouncing circuit that compares VDD to 0.6VDD (I've also tried an RC/diode/schmitt trigger circuit), which then forces the signal LO. On a scope, we see a clean square wave when the button is actuated rapidly. The

Receiving “undefined symbols” error with XC8 concerning plib I2C functions

六眼飞鱼酱① 提交于 2019-12-10 18:26:06
问题 Hey there StackOverflow! My question concerns errors being reporting within the program pasted (far) below. The target device is the PIC12LF1552 , it has one serial peripheral on it that I assumed could be used in conjunction with the library supplied with Microchip's XC8 compiler. Some sources on the internet have said that only higher end devices in the PIC18 line would support the library functions, other sources have said the library functions work just fine. So I decided that I didn't