Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/16/07 08:03
Read: times


 
#130849 - Do not hard-code adresses!
Responding to: ???'s previous message
Ellappan Varadharaj said:

i have the doubt about how to specify the port address of the pc while we interconnect with the microcontroller.

1.how to specify serial port address of the pc in the program.
2.how to specify parallel port address of the pc in the program.

You should never hard-code addresses!
ALL PC operating systems have always given the ports names like COM1: or LPT1: - use them!

The use of hard-coded addresses and direct access to the physical hardware is a key reason why old DOS software no longer works under modern operating systems like Win-NT and later...
Even in the days of DOS, such applications were inflexible, non-portable and often conflicted with other stuff on the PC.


The easiest way is to just put up a dialogue box for the user to enter the desired COM: or LPT: port number:

I said:
Do not arbitrarily restrict the COM: or LPT: port number!
See: http://www.8052.com/forum/read.phtml?id=128508

You could then use a registry key or INI file to record this as the default for future use...
http://www.8052.com/forum/read.phtml?id=130848










List of 25 messages in thread
TopicAuthorDate
doubt about ports            01/01/70 00:00      
   and one more doubt            01/01/70 00:00      
   Programming the PC            01/01/70 00:00      
   Off Topic            01/01/70 00:00      
      Wrong forum            01/01/70 00:00      
   Win ports            01/01/70 00:00      
      Bad practice...            01/01/70 00:00      
         Bad practice            01/01/70 00:00      
            some thoughts            01/01/70 00:00      
   Do not hard-code adresses!            01/01/70 00:00      
   You need to tell us more ...            01/01/70 00:00      
      MS-DOS            01/01/70 00:00      
         why?            01/01/70 00:00      
            Misunderstanding ?            01/01/70 00:00      
               Not quite so            01/01/70 00:00      
               a parallel in '51            01/01/70 00:00      
            Sharing            01/01/70 00:00      
         OK, the sad facts            01/01/70 00:00      
         MS-DOS will allow and do anything the PC can do            01/01/70 00:00      
            ...and the reason is ...            01/01/70 00:00      
               If Windows were truly multi-user/multitasking ...            01/01/70 00:00      
                  it's broken            01/01/70 00:00      
               So much for the "Good Old Days"            01/01/70 00:00      
                  Yes, and the ones that worked, worked really well            01/01/70 00:00      
                     The Right one            01/01/70 00:00      

Back to Subject List