Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Thread

Problems with UART1 on LPC2132

Problems with UART1 on LPC2132

2005-06-20 by soren_t_hansen

Hi everybody

I want to transmit a number og bytes on UART1 and some of them are 0.
When I receive the bytes on the PC, all the 0s are gone, resulting in
an error on that side. 

I use the following to transmit the bytes:

while (!(U1LSR & 0x20));
   U1THR = buffer[i];

Isn't possible to transmit a 0?

Best Regards
Søren

Re: [lpc2000] Problems with UART1 on LPC2132

2005-06-20 by Peter Jakacki

Oh, you can transmit a 0 ok, it's just that the PC may strip NULs (0's) 
from the input stream. It just comes back down to what software you are 
using to receive. But since I don't know what you are using I can't help. :)

BTW, try transmiting 0's from the PC back to the PC to test that end. 
Elimination is the 1st part of debugging.

*Peter*

soren_t_hansen wrote:
Show quoted textHide quoted text
>Hi everybody
>
>I want to transmit a number og bytes on UART1 and some of them are 0.
>When I receive the bytes on the PC, all the 0s are gone, resulting in
>an error on that side. 
>
>I use the following to transmit the bytes:
>
>while (!(U1LSR & 0x20));
>   U1THR = buffer[i];
>
>Isn't possible to transmit a 0?
>
>Best Regards
>S\ufffdren
>

Re: Problems with UART1 on LPC2132

2005-06-20 by soren_t_hansen

I use a Win32 comport to receive with. It has the following setup:

HANDLE m_hCom = 0;
m_hCom = CreateFile(m_sComPort,   // pointer to name of the file
                    GENERIC_READ | GENERIC_WRITE,   
                    0,	            
                    NULL,	            
                    OPEN_EXISTING,	    
                    FILE_FLAG_NO_BUFFERING,
                    NULL); 

I then read the comport with the following call:

ReadFile(m_hCom, buffer, length, &iBytesRead, NULL);

How can I prevent the PC from stripping the 0s?

Søren

--- In lpc2000@yahoogroups.com, Peter Jakacki <peterjak@t...> wrote:
> Oh, you can transmit a 0 ok, it's just that the PC may strip NULs (0's) 
> from the input stream. It just comes back down to what software you are 
> using to receive. But since I don't know what you are using I can't
help. :)
Show quoted textHide quoted text
> 
> BTW, try transmiting 0's from the PC back to the PC to test that end. 
> Elimination is the 1st part of debugging.
> 
> *Peter*
> 
> soren_t_hansen wrote:
> 
> >Hi everybody
> >
> >I want to transmit a number og bytes on UART1 and some of them are 0.
> >When I receive the bytes on the PC, all the 0s are gone, resulting in
> >an error on that side. 
> >
> >I use the following to transmit the bytes:
> >
> >while (!(U1LSR & 0x20));
> >   U1THR = buffer[i];
> >
> >Isn't possible to transmit a 0?
> >
> >Best Regards
> >Søren
> >

Re: Problems with UART1 on LPC2132

2005-06-20 by Carsten Grøn

Hi Søren,

well, that would be the first UART if that was the case :-)
What are you using for reception on the PC end ?
And. have you measured the TX line from the ARM to see if the '0' is 
actually sent (or not) ?

Regards,
Carsten Grøn
http://www.moonbounce.dk



--- In lpc2000@yahoogroups.com, "soren_t_hansen" 
<soren_t_hansen@y...> wrote:
> Hi everybody
> 
> I want to transmit a number og bytes on UART1 and some of them are 
0.
> When I receive the bytes on the PC, all the 0s are gone, resulting 
in
Show quoted textHide quoted text
> an error on that side. 
> 
> I use the following to transmit the bytes:
> 
> while (!(U1LSR & 0x20));
>    U1THR = buffer[i];
> 
> Isn't possible to transmit a 0?
> 
> Best Regards
> Søren

Re: Problems with UART1 on LPC2132

2005-06-20 by Carsten Grøn

Sorry, 
didn't see the other replys before posting.

The Win functions does not care about zero etc....
Do a quick check with a scope on the TX line (I'll bet the '0' is 
sent ok), but then you have ruled the ARM out....
Then, do a TX of a '0' from the PC using loopback (and to be safe, 
measure that with a scope too......



Carsten



--- In lpc2000@yahoogroups.com, Carsten Grøn <cgroen@m...> wrote:
> Hi Søren,
> 
> well, that would be the first UART if that was the case :-)
> What are you using for reception on the PC end ?
> And. have you measured the TX line from the ARM to see if the '0' 
is 
Show quoted textHide quoted text
> actually sent (or not) ?
> 
> Regards,
> Carsten Grøn
> http://www.moonbounce.dk
> 
> 
>

Re: Problems with UART1 on LPC2132

2005-06-20 by charlesgrenz

You are using the generic controls for Win32. You are going to need to
change the DCE control for windows and write your own drivers. Windows
assumes that the serial RXD and TXD will be in ASCII and not in
binary. To get binary you have to change the ASCII setting to a BINARY
setting in teh DCE and then create a RAW rxd and txd routine to allow
you to get the characters. You can probably use an ActiveX control to
help you do this so you do not have to reinvent the wheel. If you need
some ideas I can email you a link of some source code that was written
for a serial DLL that we give away to customers.

regards,
Charles


--- In lpc2000@yahoogroups.com, "soren_t_hansen" <soren_t_hansen@y...>
wrote:
> I use a Win32 comport to receive with. It has the following setup:
> 
> HANDLE m_hCom = 0;
> m_hCom = CreateFile(m_sComPort,   // pointer to name of the file
>                     GENERIC_READ | GENERIC_WRITE,   
>                     0,	            
>                     NULL,	            
>                     OPEN_EXISTING,	    
>                     FILE_FLAG_NO_BUFFERING,
>                     NULL); 
> 
> I then read the comport with the following call:
> 
> ReadFile(m_hCom, buffer, length, &iBytesRead, NULL);
> 
> How can I prevent the PC from stripping the 0s?
> 
> Søren
> 
> --- In lpc2000@yahoogroups.com, Peter Jakacki <peterjak@t...> wrote:
> > Oh, you can transmit a 0 ok, it's just that the PC may strip NULs
(0's) 
> > from the input stream. It just comes back down to what software
you are 
Show quoted textHide quoted text
> > using to receive. But since I don't know what you are using I can't
> help. :)
> > 
> > BTW, try transmiting 0's from the PC back to the PC to test that end. 
> > Elimination is the 1st part of debugging.
> > 
> > *Peter*
> > 
> > soren_t_hansen wrote:
> > 
> > >Hi everybody
> > >
> > >I want to transmit a number og bytes on UART1 and some of them are 0.
> > >When I receive the bytes on the PC, all the 0s are gone, resulting in
> > >an error on that side. 
> > >
> > >I use the following to transmit the bytes:
> > >
> > >while (!(U1LSR & 0x20));
> > >   U1THR = buffer[i];
> > >
> > >Isn't possible to transmit a 0?
> > >
> > >Best Regards
> > >Søren
> > >

RE: [lpc2000] Re: Problems with UART1 on LPC2132

2005-06-20 by Lowry, Jeff

I've been using the Mscomm control in VB with no problem.  All characters come thru.  Jeff.

________________________________
Show quoted textHide quoted text
From: lpc2000@yahoogroups.com on behalf of charlesgrenz
Sent: Mon 6/20/2005 7:16 AM
To: lpc2000@yahoogroups.com
Subject: [lpc2000] Re: Problems with UART1 on LPC2132


You are using the generic controls for Win32. You are going to need to
change the DCE control for windows and write your own drivers. Windows
assumes that the serial RXD and TXD will be in ASCII and not in
binary. To get binary you have to change the ASCII setting to a BINARY
setting in teh DCE and then create a RAW rxd and txd routine to allow
you to get the characters. You can probably use an ActiveX control to
help you do this so you do not have to reinvent the wheel. If you need
some ideas I can email you a link of some source code that was written
for a serial DLL that we give away to customers.

regards,
Charles


--- In lpc2000@yahoogroups.com, "soren_t_hansen" <soren_t_hansen@y...>
wrote:
> I use a Win32 comport to receive with. It has the following setup:
> 
> HANDLE m_hCom = 0;
> m_hCom = CreateFile(m_sComPort,   // pointer to name of the file
>                     GENERIC_READ | GENERIC_WRITE,   
>                     0,                  
>                     NULL,                  
>                     OPEN_EXISTING,          
>                     FILE_FLAG_NO_BUFFERING,
>                     NULL); 
> 
> I then read the comport with the following call:
> 
> ReadFile(m_hCom, buffer, length, &iBytesRead, NULL);
> 
> How can I prevent the PC from stripping the 0s?
> 
> Søren
> 
> --- In lpc2000@yahoogroups.com, Peter Jakacki <peterjak@t...> wrote:
> > Oh, you can transmit a 0 ok, it's just that the PC may strip NULs
(0's) 
> > from the input stream. It just comes back down to what software
you are 
> > using to receive. But since I don't know what you are using I can't
> help. :)
> > 
> > BTW, try transmiting 0's from the PC back to the PC to test that end. 
> > Elimination is the 1st part of debugging.
> > 
> > *Peter*
> > 
> > soren_t_hansen wrote:
> > 
> > >Hi everybody
> > >
> > >I want to transmit a number og bytes on UART1 and some of them are 0.
> > >When I receive the bytes on the PC, all the 0s are gone, resulting in
> > >an error on that side. 
> > >
> > >I use the following to transmit the bytes:
> > >
> > >while (!(U1LSR & 0x20));
> > >   U1THR = buffer[i];
> > >
> > >Isn't possible to transmit a 0?
> > >
> > >Best Regards
> > >Søren
> > >




________________________________

Yahoo! Groups Links


*	To visit your group on the web, go to:
	http://groups.yahoo.com/group/lpc2000/
	  
*	To unsubscribe from this group, send an email to:
	lpc2000-unsubscribe@yahoogroups.com <mailto:lpc2000-unsubscribe@yahoogroups.com?subject=Unsubscribe> 
	  
*	Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service <http://docs.yahoo.com/info/terms/> . 




[Non-text portions of this message have been removed]

Re: Problems with UART1 on LPC2132

2005-06-20 by soren_t_hansen

I'm using ordinary C/C++ in the Eclipse environment, and thus needs a
very simple way to receive these 0s. 

Isn't possible to set up the Windows generic controls to receive as
binary?

/Søren

--- In lpc2000@...m, "Lowry, Jeff" <jlowry@s...> wrote:
> I've been using the Mscomm control in VB with no problem.  All
characters come thru.  Jeff.
> 
> ________________________________
> 
> From: lpc2000@yahoogroups.com on behalf of charlesgrenz
> Sent: Mon 6/20/2005 7:16 AM
> To: lpc2000@yahoogroups.com
> Subject: [lpc2000] Re: Problems with UART1 on LPC2132
> 
> 
> You are using the generic controls for Win32. You are going to need to
> change the DCE control for windows and write your own drivers. Windows
> assumes that the serial RXD and TXD will be in ASCII and not in
> binary. To get binary you have to change the ASCII setting to a BINARY
> setting in teh DCE and then create a RAW rxd and txd routine to allow
> you to get the characters. You can probably use an ActiveX control to
> help you do this so you do not have to reinvent the wheel. If you need
> some ideas I can email you a link of some source code that was written
> for a serial DLL that we give away to customers.
> 
> regards,
> Charles
> 
> 
> --- In lpc2000@yahoogroups.com, "soren_t_hansen" <soren_t_hansen@y...>
> wrote:
> > I use a Win32 comport to receive with. It has the following setup:
> > 
> > HANDLE m_hCom = 0;
> > m_hCom = CreateFile(m_sComPort,   // pointer to name of the file
> >                     GENERIC_READ | GENERIC_WRITE,   
> >                     0,                  
> >                     NULL,                  
> >                     OPEN_EXISTING,          
> >                     FILE_FLAG_NO_BUFFERING,
> >                     NULL); 
> > 
> > I then read the comport with the following call:
> > 
> > ReadFile(m_hCom, buffer, length, &iBytesRead, NULL);
> > 
> > How can I prevent the PC from stripping the 0s?
> > 
> > Søren
> > 
> > --- In lpc2000@yahoogroups.com, Peter Jakacki <peterjak@t...> wrote:
> > > Oh, you can transmit a 0 ok, it's just that the PC may strip NULs
> (0's) 
> > > from the input stream. It just comes back down to what software
> you are 
> > > using to receive. But since I don't know what you are using I can't
> > help. :)
> > > 
> > > BTW, try transmiting 0's from the PC back to the PC to test that
end. 
> > > Elimination is the 1st part of debugging.
> > > 
> > > *Peter*
> > > 
> > > soren_t_hansen wrote:
> > > 
> > > >Hi everybody
> > > >
> > > >I want to transmit a number og bytes on UART1 and some of them
are 0.
> > > >When I receive the bytes on the PC, all the 0s are gone,
resulting in
> > > >an error on that side. 
> > > >
> > > >I use the following to transmit the bytes:
> > > >
> > > >while (!(U1LSR & 0x20));
> > > >   U1THR = buffer[i];
> > > >
> > > >Isn't possible to transmit a 0?
> > > >
> > > >Best Regards
> > > >Søren
> > > >
> 
> 
> 
> 
> ________________________________
> 
> Yahoo! Groups Links
> 
> 
> *	To visit your group on the web, go to:
> 	http://groups.yahoo.com/group/lpc2000/
> 	  
> *	To unsubscribe from this group, send an email to:
> 	lpc2000-unsubscribe@yahoogroups.com
<mailto:lpc2000-unsubscribe@yahoogroups.com?subject=Unsubscribe> 
> 	  
> *	Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service <http://docs.yahoo.com/info/terms/> . 
Show quoted textHide quoted text
> 
> 
> 
> 
> [Non-text portions of this message have been removed]

Re: [lpc2000] Re: Problems with UART1 on LPC2132

2005-06-20 by Olivier Ghislain

Le Lundi 20 Juin 2005 16:27, Lowry, Jeff a écrit :
I'm using TCport3 with C++Builder6 and i'm able to receive all byte value from 
0 to 255 coming from an embedded board  (binary logging). TCPort is working 
under C++Builder and Delphi
Show quoted textHide quoted text
> I've been using the Mscomm control in VB with no problem.  All characters
> come thru.  Jeff.
>
> ________________________________
>
> From: lpc2000@yahoogroups.com on behalf of charlesgrenz
> Sent: Mon 6/20/2005 7:16 AM
> To: lpc2000@yahoogroups.com
> Subject: [lpc2000] Re: Problems with UART1 on LPC2132
>
>
> You are using the generic controls for Win32. You are going to need to
> change the DCE control for windows and write your own drivers. Windows
> assumes that the serial RXD and TXD will be in ASCII and not in
> binary. To get binary you have to change the ASCII setting to a BINARY
> setting in teh DCE and then create a RAW rxd and txd routine to allow
> you to get the characters. You can probably use an ActiveX control to
> help you do this so you do not have to reinvent the wheel. If you need
> some ideas I can email you a link of some source code that was written
> for a serial DLL that we give away to customers.
>
> regards,
> Charles
>
>
> --- In lpc2000@yahoogroups.com, "soren_t_hansen" <soren_t_hansen@y...>
>
> wrote:
> > I use a Win32 comport to receive with. It has the following setup:
> >
> > HANDLE m_hCom = 0;
> > m_hCom = CreateFile(m_sComPort,   // pointer to name of the file
> >                     GENERIC_READ | GENERIC_WRITE,
> >                     0,
> >                     NULL,
> >                     OPEN_EXISTING,
> >                     FILE_FLAG_NO_BUFFERING,
> >                     NULL);
> >
> > I then read the comport with the following call:
> >
> > ReadFile(m_hCom, buffer, length, &iBytesRead, NULL);
> >
> > How can I prevent the PC from stripping the 0s?
> >
> > Søren
> >
> > --- In lpc2000@yahoogroups.com, Peter Jakacki <peterjak@t...> wrote:
> > > Oh, you can transmit a 0 ok, it's just that the PC may strip NULs
>
> (0's)
>
> > > from the input stream. It just comes back down to what software
>
> you are
>
> > > using to receive. But since I don't know what you are using I can't
> >
> > help. :)
> >
> > > BTW, try transmiting 0's from the PC back to the PC to test that end.
> > > Elimination is the 1st part of debugging.
> > >
> > > *Peter*
> > >
> > > soren_t_hansen wrote:
> > > >Hi everybody
> > > >
> > > >I want to transmit a number og bytes on UART1 and some of them are 0.
> > > >When I receive the bytes on the PC, all the 0s are gone, resulting in
> > > >an error on that side.
> > > >
> > > >I use the following to transmit the bytes:
> > > >
> > > >while (!(U1LSR & 0x20));
> > > >   U1THR = buffer[i];
> > > >
> > > >Isn't possible to transmit a 0?
> > > >
> > > >Best Regards
> > > >Søren
>
> ________________________________
>
> Yahoo! Groups Links
>
>
> *	To visit your group on the web, go to:
> 	http://groups.yahoo.com/group/lpc2000/
>
> *	To unsubscribe from this group, send an email to:
> 	lpc2000-unsubscribe@yahoogroups.com
> <mailto:lpc2000-unsubscribe@yahoogroups.com?subject=Unsubscribe>
>
> *	Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
> <http://docs.yahoo.com/info/terms/> .
>
>
>
>
> [Non-text portions of this message have been removed]
>
>
>
>
> Yahoo! Groups Links
>
>
>

Re: Problems with UART1 on LPC2132

2005-06-20 by lpcarmed

Look at the source of the LPC21ISP
(http://guest.engelschall.com/~martin/lpc21xx/isp/). There's a good
example how to use the windows serial port without any OCX components.
  You can even do non-blocking calls, please let me know if that's the
case and I'll help.

--- In lpc2000@yahoogroups.com, "charlesgrenz" <charles.grenz@s...> wrote:
> You are using the generic controls for Win32. You are going to need to
> change the DCE control for windows and write your own drivers. Windows
> assumes that the serial RXD and TXD will be in ASCII and not in
> binary. To get binary you have to change the ASCII setting to a BINARY
> setting in teh DCE and then create a RAW rxd and txd routine to allow
> you to get the characters. You can probably use an ActiveX control to
> help you do this so you do not have to reinvent the wheel. If you need
> some ideas I can email you a link of some source code that was written
> for a serial DLL that we give away to customers.
> 
> regards,
> Charles
> 
> 
> --- In lpc2000@yahoogroups.com, "soren_t_hansen" <soren_t_hansen@y...>
> wrote:
> > I use a Win32 comport to receive with. It has the following setup:
> > 
> > HANDLE m_hCom = 0;
> > m_hCom = CreateFile(m_sComPort,   // pointer to name of the file
> >                     GENERIC_READ | GENERIC_WRITE,   
> >                     0,	            
> >                     NULL,	            
> >                     OPEN_EXISTING,	    
> >                     FILE_FLAG_NO_BUFFERING,
> >                     NULL); 
> > 
> > I then read the comport with the following call:
> > 
> > ReadFile(m_hCom, buffer, length, &iBytesRead, NULL);
> > 
> > How can I prevent the PC from stripping the 0s?
> > 
> > Søren
> > 
> > --- In lpc2000@yahoogroups.com, Peter Jakacki <peterjak@t...> wrote:
> > > Oh, you can transmit a 0 ok, it's just that the PC may strip NULs
> (0's) 
> > > from the input stream. It just comes back down to what software
> you are 
> > > using to receive. But since I don't know what you are using I can't
> > help. :)
> > > 
> > > BTW, try transmiting 0's from the PC back to the PC to test that
end. 
> > > Elimination is the 1st part of debugging.
> > > 
> > > *Peter*
> > > 
> > > soren_t_hansen wrote:
> > > 
> > > >Hi everybody
> > > >
> > > >I want to transmit a number og bytes on UART1 and some of them
are 0.
> > > >When I receive the bytes on the PC, all the 0s are gone,
resulting in
Show quoted textHide quoted text
> > > >an error on that side. 
> > > >
> > > >I use the following to transmit the bytes:
> > > >
> > > >while (!(U1LSR & 0x20));
> > > >   U1THR = buffer[i];
> > > >
> > > >Isn't possible to transmit a 0?
> > > >
> > > >Best Regards
> > > >Søren
> > > >

Re: TCport3

2005-06-20 by donhamilton2002

--- In lpc2000@yahoogroups.com, Olivier Ghislain <ghislain_oli@y...> 
wrote:
> Le Lundi 20 Juin 2005 16:27, Lowry, Jeff a écrit :
> I'm using TCport3 with C++Builder6 and i'm able to receive all byte 
value from 


  What is TCport3 ???

hamilton

RE: [lpc2000] Re: Problems with UART1 on LPC2132

2005-06-20 by Eric Rullens

> You are using the generic controls for Win32. You are going to need to
> change the DCE control for windows and write your own drivers. Windows

??? generic controls, own drivers ???

> assumes that the serial RXD and TXD will be in ASCII and not in
> binary. To get binary you have to change the ASCII setting to a BINARY
> setting in teh DCE and then create a RAW rxd and txd routine to allow

??? DCE RAW rxd txd routine ???

> you to get the characters. You can probably use an ActiveX control to
> help you do this so you do not have to reinvent the wheel. If you need
> some ideas I can email you a link of some source code that was written
> for a serial DLL that we give away to customers.

Have you ever programmed Win32? The code below is essentially correct,
CreateFile() and ReadFile() are perfectly usable. The only thing missing is
setting up the port itself. Use SetCommState() for that.

For more reference information see:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/devio/base/
communications_functions.asp

 Eric
Show quoted textHide quoted text
> --- In lpc2000@yahoogroups.com, "soren_t_hansen" <soren_t_hansen@y...>
> wrote:
> > I use a Win32 comport to receive with. It has the following setup:
> > 
> > HANDLE m_hCom = 0;
> > m_hCom = CreateFile(m_sComPort,   // pointer to name of the file
> >                     GENERIC_READ | GENERIC_WRITE,   
> >                     0,	            
> >                     NULL,	            
> >                     OPEN_EXISTING,	    
> >                     FILE_FLAG_NO_BUFFERING,
> >                     NULL); 
> > 
> > I then read the comport with the following call:
> > 
> > ReadFile(m_hCom, buffer, length, &iBytesRead, NULL);
> > 
> > How can I prevent the PC from stripping the 0s?
> > 
> > Søren
> > 
> > --- In lpc2000@yahoogroups.com, Peter Jakacki <peterjak@t...> wrote:
> > > Oh, you can transmit a 0 ok, it's just that the PC may strip NULs
> (0's) 
> > > from the input stream. It just comes back down to what software
> you are 
> > > using to receive. But since I don't know what you are 
> using I can't
> > help. :)
> > > 
> > > BTW, try transmiting 0's from the PC back to the PC to 
> test that end. 
> > > Elimination is the 1st part of debugging.
> > > 
> > > *Peter*
> > > 
> > > soren_t_hansen wrote:
> > > 
> > > >Hi everybody
> > > >
> > > >I want to transmit a number og bytes on UART1 and some 
> of them are 0.
> > > >When I receive the bytes on the PC, all the 0s are gone, 
> resulting in
> > > >an error on that side. 
> > > >
> > > >I use the following to transmit the bytes:
> > > >
> > > >while (!(U1LSR & 0x20));
> > > >   U1THR = buffer[i];
> > > >
> > > >Isn't possible to transmit a 0?
> > > >
> > > >Best Regards
> > > >Søren
> > > >
> 
> 
> 
> 
>  
> Yahoo! Groups Links
> 
> 
> 
>  
> 
>

Re: Problems with UART1 on LPC2132

2005-06-20 by charlesgrenz

Hi Eric,

  Yes on many occasions. What you are using is based on C procedure
calls which use the NULL (0x00) character as a string delimiter. So it
can not be saved or collected as a data value.

regards,
Charles

--- In lpc2000@yahoogroups.com, Eric Rullens <gorilla@d...> wrote:
> > You are using the generic controls for Win32. You are going to need to
> > change the DCE control for windows and write your own drivers. Windows
> 
> ??? generic controls, own drivers ???
> 
> > assumes that the serial RXD and TXD will be in ASCII and not in
> > binary. To get binary you have to change the ASCII setting to a BINARY
> > setting in teh DCE and then create a RAW rxd and txd routine to allow
> 
> ??? DCE RAW rxd txd routine ???
> 
> > you to get the characters. You can probably use an ActiveX control to
> > help you do this so you do not have to reinvent the wheel. If you need
> > some ideas I can email you a link of some source code that was written
> > for a serial DLL that we give away to customers.
> 
> Have you ever programmed Win32? The code below is essentially correct,
> CreateFile() and ReadFile() are perfectly usable. The only thing
missing is
> setting up the port itself. Use SetCommState() for that.
> 
> For more reference information see:
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/devio/base/
Show quoted textHide quoted text
> communications_functions.asp
> 
>  Eric
> 
> > --- In lpc2000@...m, "soren_t_hansen" <soren_t_hansen@y...>
> > wrote:
> > > I use a Win32 comport to receive with. It has the following setup:
> > > 
> > > HANDLE m_hCom = 0;
> > > m_hCom = CreateFile(m_sComPort,   // pointer to name of the file
> > >                     GENERIC_READ | GENERIC_WRITE,   
> > >                     0,	            
> > >                     NULL,	            
> > >                     OPEN_EXISTING,	    
> > >                     FILE_FLAG_NO_BUFFERING,
> > >                     NULL); 
> > > 
> > > I then read the comport with the following call:
> > > 
> > > ReadFile(m_hCom, buffer, length, &iBytesRead, NULL);
> > > 
> > > How can I prevent the PC from stripping the 0s?
> > > 
> > > Søren
> > > 
> > > --- In lpc2000@yahoogroups.com, Peter Jakacki <peterjak@t...> wrote:
> > > > Oh, you can transmit a 0 ok, it's just that the PC may strip NULs
> > (0's) 
> > > > from the input stream. It just comes back down to what software
> > you are 
> > > > using to receive. But since I don't know what you are 
> > using I can't
> > > help. :)
> > > > 
> > > > BTW, try transmiting 0's from the PC back to the PC to 
> > test that end. 
> > > > Elimination is the 1st part of debugging.
> > > > 
> > > > *Peter*
> > > > 
> > > > soren_t_hansen wrote:
> > > > 
> > > > >Hi everybody
> > > > >
> > > > >I want to transmit a number og bytes on UART1 and some 
> > of them are 0.
> > > > >When I receive the bytes on the PC, all the 0s are gone, 
> > resulting in
> > > > >an error on that side. 
> > > > >
> > > > >I use the following to transmit the bytes:
> > > > >
> > > > >while (!(U1LSR & 0x20));
> > > > >   U1THR = buffer[i];
> > > > >
> > > > >Isn't possible to transmit a 0?
> > > > >
> > > > >Best Regards
> > > > >Søren
> > > > >
> > 
> > 
> > 
> > 
> >  
> > Yahoo! Groups Links
> > 
> > 
> > 
> >  
> > 
> >

RE: [lpc2000] Re: Problems with UART1 on LPC2132

2005-06-20 by Eric Rullens

> Hi Eric,
> 
>   Yes on many occasions. What you are using is based on C procedure
> calls which use the NULL (0x00) character as a string delimiter. So it
> can not be saved or collected as a data value.

C'mon, just stop the bs please...

The ReadFile() function couldn't care less about that. It will quite happily
write beyond any zeros in your buffer. Even beyond your buffer in fact, if
you specify the length wrong...

  Eric
Show quoted textHide quoted text
> --- In lpc2000@yahoogroups.com, Eric Rullens <gorilla@d...> wrote:
> > > You are using the generic controls for Win32. You are 
> going to need to
> > > change the DCE control for windows and write your own 
> drivers. Windows
> > 
> > ??? generic controls, own drivers ???
> > 
> > > assumes that the serial RXD and TXD will be in ASCII and not in
> > > binary. To get binary you have to change the ASCII 
> setting to a BINARY
> > > setting in teh DCE and then create a RAW rxd and txd 
> routine to allow
> > 
> > ??? DCE RAW rxd txd routine ???
> > 
> > > you to get the characters. You can probably use an 
> ActiveX control to
> > > help you do this so you do not have to reinvent the 
> wheel. If you need
> > > some ideas I can email you a link of some source code 
> that was written
> > > for a serial DLL that we give away to customers.
> > 
> > Have you ever programmed Win32? The code below is 
> essentially correct,
> > CreateFile() and ReadFile() are perfectly usable. The only thing
> missing is
> > setting up the port itself. Use SetCommState() for that.
> > 
> > For more reference information see:
> >
> http://msdn.microsoft.com/library/default.asp?url=/library/en-
> us/devio/base/
> > communications_functions.asp
> > 
> >  Eric
> > 
> > > --- In lpc2000@yahoogroups.com, "soren_t_hansen" 
> <soren_t_hansen@y...>
> > > wrote:
> > > > I use a Win32 comport to receive with. It has the 
> following setup:
> > > > 
> > > > HANDLE m_hCom = 0;
> > > > m_hCom = CreateFile(m_sComPort,   // pointer to name of the file
> > > >                     GENERIC_READ | GENERIC_WRITE,   
> > > >                     0,	            
> > > >                     NULL,	            
> > > >                     OPEN_EXISTING,	    
> > > >                     FILE_FLAG_NO_BUFFERING,
> > > >                     NULL); 
> > > > 
> > > > I then read the comport with the following call:
> > > > 
> > > > ReadFile(m_hCom, buffer, length, &iBytesRead, NULL);
> > > > 
> > > > How can I prevent the PC from stripping the 0s?
> > > > 
> > > > Søren
> > > > 
> > > > --- In lpc2000@yahoogroups.com, Peter Jakacki 
> <peterjak@t...> wrote:
> > > > > Oh, you can transmit a 0 ok, it's just that the PC 
> may strip NULs
> > > (0's) 
> > > > > from the input stream. It just comes back down to 
> what software
> > > you are 
> > > > > using to receive. But since I don't know what you are 
> > > using I can't
> > > > help. :)
> > > > > 
> > > > > BTW, try transmiting 0's from the PC back to the PC to 
> > > test that end. 
> > > > > Elimination is the 1st part of debugging.
> > > > > 
> > > > > *Peter*
> > > > > 
> > > > > soren_t_hansen wrote:
> > > > > 
> > > > > >Hi everybody
> > > > > >
> > > > > >I want to transmit a number og bytes on UART1 and some 
> > > of them are 0.
> > > > > >When I receive the bytes on the PC, all the 0s are gone, 
> > > resulting in
> > > > > >an error on that side. 
> > > > > >
> > > > > >I use the following to transmit the bytes:
> > > > > >
> > > > > >while (!(U1LSR & 0x20));
> > > > > >   U1THR = buffer[i];
> > > > > >
> > > > > >Isn't possible to transmit a 0?
> > > > > >
> > > > > >Best Regards
> > > > > >Søren
> > > > > >
> > > 
> > > 
> > > 
> > > 
> > >  
> > > Yahoo! Groups Links
> > > 
> > > 
> > > 
> > >  
> > > 
> > >
> 
> 
> 
> 
> 
>  
> Yahoo! Groups Links
> 
> 
> 
>  
> 
>

RE: [lpc2000] Re: Problems with UART1 on LPC2132

2005-06-20 by Eric Rullens

> Sorry, 
> didn't see the other replys before posting.
> 
> The Win functions does not care about zero etc....

They can, in fact. See the fNull member in the DCB structure. But this
'feature' generally isn't used.

> Do a quick check with a scope on the TX line (I'll bet the '0' is 
> sent ok), but then you have ruled the ARM out....
> Then, do a TX of a '0' from the PC using loopback (and to be safe, 
> measure that with a scope too......

Scoping the lines has my preference too. ;-)

  Eric
Show quoted textHide quoted text
> --- In lpc2000@yahoogroups.com, Carsten Grøn <cgroen@m...> wrote:
> > Hi Søren,
> > 
> > well, that would be the first UART if that was the case :-)
> > What are you using for reception on the PC end ?
> > And. have you measured the TX line from the ARM to see if the '0' 
> is 
> > actually sent (or not) ?
> > 
> > Regards,
> > Carsten Grøn
> > http://www.moonbounce.dk
> > 
> > 
> > 
> 
> 
> 
> 
>  
> Yahoo! Groups Links
> 
> 
> 
>  
> 
> 
>

Re: Problems with UART1 on LPC2132

2005-06-21 by Owen Mooney

Hes write about the binary - the flag needs to be set in the dcb

If anyone sends me an email I will return a complete win32 source
in c or pascal

Owen Mooney


You are using the generic controls for Win32. You are going to need to
change the DCE control for windows and write your own drivers. Windows
assumes that the serial RXD and TXD will be in ASCII and not in
binary. To get binary you have to change the ASCII setting to a BINARY
setting in teh DCE and then create a RAW rxd and txd routine to allow
you to get the characters. You can probably use an ActiveX control to
help you do this so you do not have to reinvent the wheel. If you need
some ideas I can email you a link of some source code that was written
for a serial DLL that we give away to customers.

regards,
Charles


--- In lpc2000@yahoogroups.com, "soren_t_hansen" <soren_t_hansen@y...>
wrote:

>> I use a Win32 comport to receive with. It has the following setup:
>> 
>> HANDLE m_hCom = 0;
>> m_hCom = CreateFile(m_sComPort,   // pointer to name of the file
>>                     GENERIC_READ | GENERIC_WRITE,   
>>                     0,                  
>>                     NULL,                  
>>                     OPEN_EXISTING,          
>>                     FILE_FLAG_NO_BUFFERING,
>>                     NULL); 
>> 
>> I then read the comport with the following call:
>> 
>> ReadFile(m_hCom, buffer, length, &iBytesRead, NULL);
>> 
>> How can I prevent the PC from stripping the 0s?
>> 
>> S\ufffdren
>> 
>> --- In lpc2000@yahoogroups.com, Peter Jakacki <peterjak@t...> wrote:
>  
>
>>> > Oh, you can transmit a 0 ok, it's just that the PC may strip NULs
>>    
>>
(0's) 

>>> > from the input stream. It just comes back down to what software
>>    
>>
you are 
Show quoted textHide quoted text
>>> > using to receive. But since I don't know what you are using I can't
>>    
>>
>> help.  :) 
>  
>
>>> > 
>>> > BTW, try transmiting 0's from the PC back to the PC to test that end. 
>>> > Elimination is the 1st part of debugging.
>>> > 
>>> > *Peter*
>>> > 
>>> > soren_t_hansen wrote:
>>> > 
>>    
>>
>>>> > >Hi everybody
>>>> > >
>>>> > >I want to transmit a number og bytes on UART1 and some of them are 0.
>>>> > >When I receive the bytes on the PC, all the 0s are gone, resulting in
>>>> > >an error on that side. 
>>>> > >
>>>> > >I use the following to transmit the bytes:
>>>> > >
>>>> > >while (!(U1LSR & 0x20));
>>>> > >   U1THR = buffer[i];
>>>> > >
>>>> > >Isn't possible to transmit a 0?
>>>> > >
>>>> > >Best Regards
>>>> > >S\ufffdren
>>>> > >
>>>      
>>>

Re: Problems with UART1 on LPC2132

2005-06-21 by soren_t_hansen

Hello everybody, and thanks for the many answers.

It turned out that the problem could be solved very easily, by
changing the fNull in the DCB from true to false :o)

Best Regards
Søren

--- In lpc2000@yahoogroups.com, Eric Rullens <gorilla@d...> wrote:
Show quoted textHide quoted text
> > Sorry, 
> > didn't see the other replys before posting.
> > 
> > The Win functions does not care about zero etc....
> 
> They can, in fact. See the fNull member in the DCB structure. But this
> 'feature' generally isn't used.
>

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.