NO

Author Topic: com port works in vs2017-win10-64, doesnt work in pelles8  (Read 185 times)

Offline bobgardner

  • Member
  • *
  • Posts: 2
com port works in vs2017-win10-64, doesnt work in pelles8
« on: June 21, 2018, 09:02:33 pm »
I have an old windows console app that is a small terminal program. I can use it in a console app like a bootloader to talk to my microcontrollers. The micro talks to teraterm just fine at 115200. The vs2017 compile of the term program also shows the menus from the micro at 115200. The same 13k c file compiled with pellesc8 spits out binary, like the stopbits or baudrate is bonkers. There is a bug report that the comport dcb struct might not be padded right or something. The com port stuff is in winbase.h. When I include windows.h in the pelles compile, it gets included from the pelles includes right? I have win10-64 on my machine. At work I'm running win7-32 and probably an older version of pelles, and everything was working. So, there's something about the serial port stuff that isn't working. Maybe someone can write a c console app that sends 'the quick brown fox' out a serial port at 115200 and compile it in vs and pelles, see if it works, report your os ver and 32/64. Thanks folks.

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 1720
Re: com port works in vs2017-win10-64, doesnt work in pelles8
« Reply #1 on: June 21, 2018, 10:37:42 pm »
No difference with this code:
Code: [Select]
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <stdio.h>
#include <stddef.h>
#pragma comment(lib, "msvcrt.lib")

int main(int argc, char *argv[])
{
DCB dcb = { sizeof(DCB) };
printf("sizeof(DCB) %d 28\n", sizeof(DCB));
printf("DCBlength: %d 0\n", offsetof(DCB,DCBlength));
printf("BaudRate:  %d 4\n", offsetof(DCB,BaudRate));
printf("wReserved: %d 12\n", offsetof(DCB,wReserved));
printf("Parity:    %d 19\n", offsetof(DCB,Parity));
printf("wReserved1:%d 26\n", offsetof(DCB,wReserved1));
return 0;
}
May the source be with you

Offline bobgardner

  • Member
  • *
  • Posts: 2
Re: com port works in vs2017-win10-64, doesnt work in pelles8
« Reply #2 on: June 22, 2018, 11:41:29 pm »
Thanks for the quick reply. Seems like long ago there was CreateFile and now its CreateFileA. Change one letter and my program starts working. I guess the old vc 16 bit version that worked was using CreateFile. Trying to compile it on pellesc8 something was bonkers and it looks like the CreateFileA was it. Everyday its something isnt it? Appreciate the help.