• Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

C programming question - using in arduino

Joined
Dec 22, 2007
Messages
184 (0.03/day)
Location
Central Nebraska
System Name CORSAIR
Processor AMD Phenom 1090T x6 @3.2
Motherboard Gigabyte Ga-78LMT-S2P
Cooling High efficiency dust cooling
Memory 8GB GSkill DDR3 1333
Video Card(s) Sapphire Radeon HD3870 512MB GDDR4 PCI-e toxic
Storage Seagate SV35.3 ST3250310SV 250GB SATAII(Windows 7 Pro x64), 320GB Samsung SATAII(Storage and SuSE)
Display(s) Dell 20" LCD, Dell 17" LCD
Power Supply Antec Cool Blue 650W Modular
Software Windows 7 Professional SP1, Visual Studio 2010 Ultimate
Hey all - my friend and I are trying to get this code to work, but the compiler is giving us the error: "initializer fails to determine size of '__c'".

We are TRYING to create a variable, then assign it the value of whatever is read on the rx serial port pin, then printf that variable.

Code:
#include "hardware.h"


// Initialise the hardware
void appInitHardware(void) {
	initHardware();
}
// Initialise the software
TICK_COUNT appInitSoftware(TICK_COUNT loopStart){
	return 0;
}
// This is the main loop
TICK_COUNT appControl(LOOP_COUNT loopCount, TICK_COUNT loopStart) {

if(myUart.isRxBufferEmpty() == false) {
	int InstreamData = myUart.read();
	if(InstreamData != 0){
		PRINTF(stdout,InstreamData);
	}
}
	return 0;
}
 
Last edited:

de.das.dude

Pro Indian Modder
Joined
Jun 13, 2010
Messages
8,783 (1.74/day)
Location
Stuck in a PC. halp.
System Name Monke | Work Thinkpad| Old Monke
Processor Ryzen 5600X | Ryzen 5500U | FX8320
Motherboard ASRock B550 Extreme4 | ? | Asrock 990FX Extreme 4
Cooling 240mm Rad | Not needed | hyper 212 EVO
Memory 2x16GB DDR4 3600 Corsair RGB | 16 GB DDR4 3600 | 16GB DDR3 1600
Video Card(s) Sapphire Pulse RX6700XT 12GB | Vega 8 | Sapphire Pulse RX580 8GB
Storage Samsung 980 nvme (Primary) | some samsung SSD
Display(s) Dell 2723DS | Some 14" 1080p 98%sRGB IPS | Dell 2240L
Case Ant Esports Tempered case | Thinkpad | Antec
Audio Device(s) Logitech Z333 | Jabra corpo stuff
Power Supply Corsair RM750e | not needed | Corsair GS 600
Mouse Logitech G400 | nipple
Keyboard Logitech G213 | stock kb is awesome | Logitech K230
VR HMD ;_;
Software Windows 10 Professional x3
Benchmark Scores There are no marks on my bench
i think the size of your code is greater than what the chip you have can take
also where is nothing in the program? all of them are comments?


i may be wrong, i dont have much arduino knowledge. but no one replied so here i am.
 
Joined
Dec 22, 2007
Messages
184 (0.03/day)
Location
Central Nebraska
System Name CORSAIR
Processor AMD Phenom 1090T x6 @3.2
Motherboard Gigabyte Ga-78LMT-S2P
Cooling High efficiency dust cooling
Memory 8GB GSkill DDR3 1333
Video Card(s) Sapphire Radeon HD3870 512MB GDDR4 PCI-e toxic
Storage Seagate SV35.3 ST3250310SV 250GB SATAII(Windows 7 Pro x64), 320GB Samsung SATAII(Storage and SuSE)
Display(s) Dell 20" LCD, Dell 17" LCD
Power Supply Antec Cool Blue 650W Modular
Software Windows 7 Professional SP1, Visual Studio 2010 Ultimate
These chips can handle WAYYY more code than this :p. The problem I dont believe its even related to arduino or the chip at all.. this is a c compiler giving the error before it ever hits the chip
 

de.das.dude

Pro Indian Modder
Joined
Jun 13, 2010
Messages
8,783 (1.74/day)
Location
Stuck in a PC. halp.
System Name Monke | Work Thinkpad| Old Monke
Processor Ryzen 5600X | Ryzen 5500U | FX8320
Motherboard ASRock B550 Extreme4 | ? | Asrock 990FX Extreme 4
Cooling 240mm Rad | Not needed | hyper 212 EVO
Memory 2x16GB DDR4 3600 Corsair RGB | 16 GB DDR4 3600 | 16GB DDR3 1600
Video Card(s) Sapphire Pulse RX6700XT 12GB | Vega 8 | Sapphire Pulse RX580 8GB
Storage Samsung 980 nvme (Primary) | some samsung SSD
Display(s) Dell 2723DS | Some 14" 1080p 98%sRGB IPS | Dell 2240L
Case Ant Esports Tempered case | Thinkpad | Antec
Audio Device(s) Logitech Z333 | Jabra corpo stuff
Power Supply Corsair RM750e | not needed | Corsair GS 600
Mouse Logitech G400 | nipple
Keyboard Logitech G213 | stock kb is awesome | Logitech K230
VR HMD ;_;
Software Windows 10 Professional x3
Benchmark Scores There are no marks on my bench
HTML:
#include <hardware.h>


// Initialise the hardware
void appInitHardware(void)
{
	initHardware();
}
// Initialise the software
TICK_COUNT appInitSoftware(TICK_COUNT loopStart)
{
	return 0;
}
// This is the main loop
TICK_COUNT appControl(LOOP_COUNT loopCount,TICK_COUNT loopStart)
{

if(myUart.isRxBufferEmpty()==false) 
           {
	        int InstreamData=myUart.read();
	        if(InstreamData!=0)
                   {
		printf(stdout,InstreamData);
	        }
           }
	return 0;
}


try this. copy paste it.

ithink i may have fixed a couple of grammatical errors. have you tried running it in borland C ?
 

W1zzard

Administrator
Staff member
Joined
May 14, 2004
Messages
27,037 (3.71/day)
Processor Ryzen 7 5700X
Memory 48 GB
Video Card(s) RTX 4080
Storage 2x HDD RAID 1, 3x M.2 NVMe
Display(s) 30" 2560x1600 + 19" 1280x1024
Software Windows 10 64-bit
Mentioning the line number for the error would make things much easier :)

You are using printf wrong. Parameter 1 is a format string, not a file handle (looking for fprintf?)

http://playground.arduino.cc/Main/Printf

also see the comment on that page about PSTR()
 
Joined
Dec 22, 2007
Messages
184 (0.03/day)
Location
Central Nebraska
System Name CORSAIR
Processor AMD Phenom 1090T x6 @3.2
Motherboard Gigabyte Ga-78LMT-S2P
Cooling High efficiency dust cooling
Memory 8GB GSkill DDR3 1333
Video Card(s) Sapphire Radeon HD3870 512MB GDDR4 PCI-e toxic
Storage Seagate SV35.3 ST3250310SV 250GB SATAII(Windows 7 Pro x64), 320GB Samsung SATAII(Storage and SuSE)
Display(s) Dell 20" LCD, Dell 17" LCD
Power Supply Antec Cool Blue 650W Modular
Software Windows 7 Professional SP1, Visual Studio 2010 Ultimate
line 23: the printf error. I think it's because we're tryign to call a dynamic value
 
Top