I am not too familliar with the XMOS XC coding language as of yet, and still vague in areas in C/C++. I am familliar with the Arduino C/C++ and the functions that are built in that language. My problem comes to me when I try to read the output of an absolute encoder from an input pin. In the Arduino environment, this can be done by simply using the pulseIn function (ex: x = pulseIn(pin, HIGH);). This returns values from my encoder of 0-1024. I know that this is an Arduino only function and that it links up into other libraries within itself. All I need to do is to be able to simply read the values from the encoder. I have no idea how to accomplish this in XC or in straight C.
The other thing I may need to do is simply send a binary signal to a motor controller. I just don't know the syntax for that. In Arduino, you declare a variable as a byte, then send it via serial.write command.
Measuring Encoder Output
-
- Newbie
- Posts: 1
- Joined: Thu Jan 22, 2015 5:22 pm
-
- Respected Member
- Posts: 275
- Joined: Fri Mar 12, 2010 6:03 pm
The programming guide contains a good introduction to I/O programming on the xCORE architecture
http://www.xmos.com/published/xmos-programming-guide Have a look at chapter 6, which should be a good starting point.
http://www.xmos.com/published/xmos-programming-guide Have a look at chapter 6, which should be a good starting point.