Pilote of Picoscope 4262 by Borland C++

Post your C and C++ discussions here
Post Reply
XavierPico
Newbie
Posts: 0
Joined: Thu Jan 23, 2020 5:16 pm

Pilote of Picoscope 4262 by Borland C++

Post by XavierPico »

Dear all,
I have tried to control Picoscope 4262 with Borland C++ Builder 32bits under Windows 10.
After importing the ps4000.dll, the compilation is ok, but when I use int32_t VC_main() extracted from ps4000Con.c, see code below, there are link errors:
[ILINK32 Error] Error: Unresolved external '_tcgetattr' referenced from
C:\USERS\DEBUG_BUILD\WAVEDATAPICO4262.OBJ
[ILINK32 Error] Error: Unable to perform link.

If I understand, the function tcgetattr is only for Linux, but my program is under Windows. Why come from the errors?
Thanks a lot in advance
Xavier

Code: Select all

int32_t VC_main(void)
{
  int8_t ch;
  int32_t i;
  PICO_STATUS status;
  UNIT_MODEL unit;
  struct tPwq pulseWidth;
  struct tTriggerDirections directions;

  printf("PicoScope 4000 Series (ps4000) Driver Example Program\n");
  printf("\n\nOpening the device...\n");

  status = ps4000OpenUnit(&(unit.handle));
  printf("Handle: %d\n", unit.handle);

  if (status != PICO_OK && status != PICO_EEPROM_CORRUPT)
  {
	printf("Unable to open device\n");
	printf("Error code : %d\n", (int32_t)status);
	while (!_kbhit());
	exit(99); // exit program - nothing after this executes
  }

  printf("Device opened successfully, cycle %d\n\n", ++cycles);

  // setup devices
  get_info(&unit);
  timebase = 1;

  for (i = 0; i < MAX_CHANNELS; i++)
  {
	unit.channelSettings[i].enabled = TRUE;
	unit.channelSettings[i].DCcoupled = TRUE;
	unit.channelSettings[i].range = PS4000_5V;
  }

  memset(&directions, 0, sizeof(struct tTriggerDirections));
  memset(&pulseWidth, 0, sizeof(struct tPwq));

  SetDefaults(&unit);

  /* Trigger disabled	*/
  SetTrigger(unit.handle, NULL, 0, NULL, 0, &directions, &pulseWidth, 0, 0, 0);

  ch = ' ';
  while (ch != 'X')
  {
	DisplaySettings(&unit);

	printf("\n");
	printf("B - Immediate block                             V - Set voltages\n");
	printf("T - Triggered block                             I - Set timebase\n");
	printf("R - Immediate rapid block with aggregation      A - ADC counts/mV\n");
	printf("N - Rapid block without aggregation\n");
	printf("Q - Collect a block using ETS\n");
	printf("S - Immediate streaming\n");
	printf("W - Triggered streaming\n");
	printf("G - Signal generator\n");
	printf("                                                X - Exit\n");
	printf("Operation:");

	ch = toupper(_getch());
	printf("\n\n");

	switch (ch)
	{
	case 'B':
	  CollectBlockImmediate(&unit);
	  break;

	case 'R':
	  CollectRapidBlockImmediate(&unit);
	  break;

	case 'N':
	  CollectRapidBlock_No_Agg(&unit);
	  break;

	case 'T':
	  CollectBlockTriggered(&unit);
	  break;

	case 'S':
	  CollectStreamingImmediate(&unit);
	  break;

	case 'W':
	  CollectStreamingTriggered(&unit);
	  break;

	case 'Q':

	  if (unit.ETS == FALSE)
	  {
		printf("This model does not have ETS\n\n");
		break;
	  }
	  CollectBlockEts(&unit);
	  break;

	case 'G':
	  if (unit.signalGenerator == FALSE)
	  {
		printf("This model does not have a signal generator\n\n");
		break;
	  }
	  SetSignalGenerator(unit);
	  break;

	case 'V':
	  set_voltages(&unit);
	  break;

	case 'I':
	  SetTimebase(unit);
	  break;

	case 'A':
	  scaleVoltages = !scaleVoltages;
	  break;

	case 'X':
	  break;

	default:
	  printf("Invalid operation\n");
	  break;
	}

  }
  ps4000CloseUnit(unit.handle);
  return 1;
}
 

Martyn
Site Admin
Site Admin
Posts: 4499
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Pilote of Picoscope 4262 by Borland C++

Post by Martyn »

Rather than taking parts from the example does it run as it is?
Martyn
Technical Support Manager

XavierPico
Newbie
Posts: 0
Joined: Thu Jan 23, 2020 5:16 pm

Re: Pilote of Picoscope 4262 by Borland C++

Post by XavierPico »

As I use Borland C++, I can't use directly a c program.
I don't know how to compile the exemple under C++ Builder. Unkown: , and .
Many thanks
Xavier

XavierPico
Newbie
Posts: 0
Joined: Thu Jan 23, 2020 5:16 pm

Re: Pilote of Picoscope 4262 by Borland C++

Post by XavierPico »

Please see:
https://www.picotech.com/support/topic39407.html?sid=

Post Reply