assign output from C? Topic is solved

If you have a simple question and just want an answer.
Posts: 28
Joined: Wed Jul 04, 2018 4:06 pm

assign output from C?

Postby jsaksris » Thu Nov 08, 2018 2:52 pm

How can we assign pin output from .c file?

As the <: syntax is not available.
as well as 'port' / 'on tile[]'
View Solution
User avatar
XCore Legend
Posts: 1889
Joined: Thu Jun 10, 2010 11:43 am

Postby mon2 » Thu Nov 08, 2018 4:37 pm

Hi. Rename your source code file to .xc and try again.

Which hardware kit are you using for this testing?

Which port pins are you attempting to drive with an output?

You can review the following: ... led#p31562

if using the XCORE Audio board. Hope this helps.
Posts: 28
Joined: Wed Jul 04, 2018 4:06 pm

Postby jsaksris » Thu Nov 08, 2018 5:03 pm

What I have found out that if I use a global variable between XC, and C by using extern keyword..
The variable end-up in a different address somehow(found this while debugging).

I have wrote an interface that would change the LEDs based on this value.
Since it's not the in the same address, the change in the value in C does not effect the one in XC.

I was desperate enough to try to change the LEDs directly from C file.. which is the part of the module_usb_audio > endpoint0 > endpoint0.c
I'm using the XCORE Audio board.. I'll dig into your thread tomorrow.

For those ran into this thread look for a way to interact between XC and C file.
you might find this useful.
User avatar
XCore Expert
Posts: 522
Joined: Thu Nov 26, 2015 11:47 pm

Postby akp » Thu Nov 08, 2018 9:09 pm

If you can rewrite your code in XC or make an XC wrapper for your C code I think you will be happier in the long run. Maybe your XC code can call a C function that returns the LED state or something, rather than using a global variable to talk between XC and C.

Who is online

Users browsing this forum: No registered users and 0 guests