elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Los 10 CVE más críticos (peligrosos) de 2020


  Mostrar Mensajes
Páginas: 1 ... 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 [211] 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 ... 255
2101  Informática / Electrónica / Re: Por donde empezar con la electrónica digital? en: 8 Marzo 2009, 10:15 am
Si te refieres a un simulador analógico pues en www.linear.com
2102  Informática / Electrónica / Re: Esquema de un multiplicador digital de 8 bits en: 8 Marzo 2009, 10:14 am
Mejor usar microcontroaldores PIC 16F84A para ahorrar muchas cosas.

http://www.abcdatos.com/tutoriales/tutorial/z9316.html

Saludo.
2103  Informática / Electrónica / Re: Por donde empezar con la electrónica digital? en: 2 Marzo 2009, 21:57 pm
Si te gusta PIC pues...

www.pic16f84a.org

http://www.abcdatos.com/tutoriales/tutorial/z9316.html

Saludos.
2104  Informática / Electrónica / Re: Los inicios para un novato en electronica... en: 2 Marzo 2009, 21:55 pm
Hay también microcontroladores como grabar PIC que está relacionado con la electrónica.

http://www.abcdatos.com/tutoriales/tutorial/z9316.html

Saludos.
2105  Programación / Programación Visual Basic / Manual de prueba VC++ y VB sobre RS232 en: 28 Febrero 2009, 19:44 pm
Hola:

Estoy haciendo la continuación del manual sobre Visual C# de la parte de MonoDevelop 1 bajo Linux, por otro lado algo de Visual C++ y Visual Basic.

El único código funcional es el VC++, el VB funciona aunque no está publicado porque está hecho a la chapuza. Cuando lo haga seriamente lo publico en el manual. Si alguien quiere ese código ya, me lo dicen y lo pongo aquí, funciona, pero no es el adecuado, hay otro método que estoy averiguando en hacerlo más cómodo y con menos código.

El manual no está acabado, sólo verán su estilo a ver si les gusta y yo mismo ver sus sugerencias.

DESCARGAR Manual PDF

Un cordial saludo.
2106  Programación / .NET (C#, VB.NET, ASP) / Re: Activar un comando al cerrar la aplicación. en: 26 Febrero 2009, 08:47 am
en el evento Closed o Closing del programa llama a la función que maneja el otro evento que dices...


oops bueno... si es el mismo programa que pusiste en msdn estas en windows forms supongo...


saludos...  ::)

Me funciona, gracias.
2107  Programación / .NET (C#, VB.NET, ASP) / Activar un comando al cerrar la aplicación. en: 24 Febrero 2009, 18:34 pm
Hola:

Tengo un código hecho con Visual C#  Express. Se trata de que uso el puerto serie, si pulso un botón dejo la comunicación activa, si cierro el programa principal, el dato enviado por el puerto serie que lleva hasta un PIC16F84A está activo, antes de cerrar el programa debo pulsar el otro botón para desactivar el PIC por el puerto serie. Me gustaría saber si hay una posibilidad de que se cuando cierre la aplicación, envíe un comando del mismo botón que hace que se desactive el PIC. Espero averiguar o al menos saber si existe hacer esa posibilidad.

Código
  1.            byte[] mBuffer = new byte[1];
  2.            mBuffer[0] = 0x20; //ASCII letra "Espacio".
  3.            serialPort1.Write(mBuffer, 0, mBuffer.Length);

Un cordial saludo.
2108  Programación / .NET (C#, VB.NET, ASP) / Re: Puerto serie RS232 en: 23 Febrero 2009, 23:33 pm
Vamos a empezar desde el principio.

Utilizando el Mono con gtk#, he introducido un botón normal en el formulario. El código completo lo he hecho de nuevo y ahora es así. Ejecuta sin problemas pero al pulsar el botón hay errores que no se el motivo.

Código
  1. // MainWindow.cs created with MonoDevelop
  2. // User: metaconta at 20:59 23/02/2009
  3. //
  4. // To change standard headers go to Edit->Preferences->Coding->Standard Headers
  5. //
  6. using System;
  7. using Gtk;
  8. using System.IO.Ports;
  9.  
  10. public partial class MainWindow: Gtk.Window
  11. {
  12. public MainWindow (): base (Gtk.WindowType.Toplevel)
  13. {
  14. Build ();
  15. }
  16.  
  17. protected void OnDeleteEvent (object sender, DeleteEventArgs a)
  18. {
  19. Application.Quit ();
  20. a.RetVal = true;
  21. }
  22.  
  23. public SerialPort mySerial;
  24.  
  25. protected virtual void OnButtonTClicked (object sender, System.EventArgs e)
  26. {
  27. mySerial = new SerialPort("/dev/ttyS0", 9600, Parity.None, 8, StopBits.Two);
  28. mySerial.Open();
  29. byte[] mBuffer = new byte[1];
  30. mBuffer[0] = 0x74; // LA letra t.
  31. mySerial.Write(mBuffer, 0, mBuffer.Length);
  32. mySerial.Close();
  33. }
  34. }
  35.  

En el mensaje de error me da esto:
Código
  1.  
  2. Marshaling clicked signal
  3. Exception in Gtk# callback delegate
  4.  Note: Applications can use GLib.ExceptionManager.UnhandledException to handle the exception.
  5. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.IOException: Permiso denegado
  6.  at System.IO.Ports.SerialPortStream.ThrowIOException () [0x00012] in /usr/src/packages/BUILD/mono-2.0.1/mcs/class/System/System.IO.Ports/SerialPortStream.cs:299
  7.  at System.IO.Ports.SerialPortStream..ctor (System.String portName, Int32 baudRate, Int32 dataBits, Parity parity, StopBits stopBits, Boolean dtrEnable, Boolean rtsEnable, Handshake handshake, Int32 readTimeout, Int32 writeTimeout, Int32 readBufferSize, Int32 writeBufferSize) [0x0001e] in /usr/src/packages/BUILD/mono-2.0.1/mcs/class/System/System.IO.Ports/SerialPortStream.cs:36
  8.  at (wrapper remoting-invoke-with-check) System.IO.Ports.SerialPortStream:.ctor (string,int,int,System.IO.Ports.Parity,System.IO.Ports.StopBits,bool,bool,System.IO.Ports.Handshake,int,int,int,int)
  9.  at System.IO.Ports.SerialPort.Open () [0x00078] in /usr/src/packages/BUILD/mono-2.0.1/mcs/class/System/System.IO.Ports/SerialPort.cs:563
  10.  at (wrapper remoting-invoke-with-check) System.IO.Ports.SerialPort:Open ()
  11.  at MainWindow.OnButtonTClicked (System.Object sender, System.EventArgs e) [0x00018] in /home/metaconta/Prueba_02/Prueba_02/MainWindow.cs:28
  12.  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception&)
  13.  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00057] in /usr/src/packages/BUILD/mono-2.0.1/mcs/class/corlib/System.Reflection/MonoMethod.cs:157
  14.  --- End of inner exception stack trace ---
  15.  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00071] in /usr/src/packages/BUILD/mono-2.0.1/mcs/class/corlib/System.Reflection/MonoMethod.cs:167
  16.  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in /usr/src/packages/BUILD/mono-2.0.1/mcs/class/corlib/System.Reflection/MethodBase.cs:110
  17.  at System.Delegate.DynamicInvokeImpl (System.Object[] args) [0x000b4] in /usr/src/packages/BUILD/mono-2.0.1/mcs/class/corlib/System/Delegate.cs:422
  18.  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x00018] in /usr/src/packages/BUILD/mono-2.0.1/mcs/class/corlib/System/MulticastDelegate.cs:71
  19.  at System.Delegate.DynamicInvoke (System.Object[] args) [0x00000] in /usr/src/packages/BUILD/mono-2.0.1/mcs/class/corlib/System/Delegate.cs:394
  20.  at GLib.Signal.ClosureInvokedCB (System.Object o, GLib.ClosureInvokedArgs args) [0x0004f] in /usr/src/packages/BUILD/gtk-sharp-2.12.6/glib/Signal.cs:195
  21.  at GLib.SignalClosure.Invoke (GLib.ClosureInvokedArgs args) [0x0000c] in /usr/src/packages/BUILD/gtk-sharp-2.12.6/glib/SignalClosure.cs:118
  22.  at GLib.SignalClosure.MarshalCallback (IntPtr raw_closure, IntPtr return_val, UInt32 n_param_vals, IntPtr param_values, IntPtr invocation_hint, IntPtr marshal_data) [0x0007a] in /usr/src/packages/BUILD/gtk-sharp-2.12.6/glib/SignalClosure.cs:146
  23.   at GLib.ExceptionManager.RaiseUnhandledException(System.Exception e, Boolean is_terminal) in /usr/src/packages/BUILD/gtk-sharp-2.12.6/glib/ExceptionManager.cs:line 58
  24.   at GLib.SignalClosure.MarshalCallback(IntPtr raw_closure, IntPtr return_val, UInt32 n_param_vals, IntPtr param_values, IntPtr invocation_hint, IntPtr marshal_data) in /usr/src/packages/BUILD/gtk-sharp-2.12.6/glib/SignalClosure.cs:line 173
  25.   at Gtk.Application.gtk_main()
  26.   at Gtk.Application.Run() in /usr/src/packages/BUILD/gtk-sharp-2.12.6/gtk/generated/AboutDialog.cs:line 1
  27.   at Prueba_02.MainClass.Main(System.String[] args) in /home/metaconta/Prueba_02/Prueba_02/Main.cs:line 18
  28.  
  29.  
  30.  
2109  Programación / .NET (C#, VB.NET, ASP) / Puerto serie RS232 en: 23 Febrero 2009, 21:39 pm
Hola:

Estoy con MonoDevelop con el openSUSE 11.1. Mirando esta web http://www.mono-project.com/HowToSystemIOPorts quiero configurar el puerto serie como a mi me de la gana.

Lo he puesto así:

Código
  1. mySerial new SerialPort("/dev/ttyS0", 9600, None, 8, Two);

La otra manera con comillas así:

Código
  1. mySerial new SerialPort("/dev/ttyS0", 9600, "None", 8, "Two");

Código completo:

Código
  1. // MainWindow.cs created with MonoDevelop
  2. // User: metaconta at 17:46 23/02/2009
  3. //
  4. // To change standard headers go to Edit->Preferences->Coding->Standard Headers
  5. //
  6. using System;
  7. using Gtk;
  8. using System.IO.Ports;
  9.  
  10. public partial class MainWindow: Gtk.Window
  11. {
  12. public MainWindow (): base (Gtk.WindowType.Toplevel)
  13. {
  14. Build ();
  15. }
  16.  
  17. protected void OnDeleteEvent (object sender, DeleteEventArgs a)
  18. {
  19. Application.Quit ();
  20. a.RetVal = true;
  21. }
  22.  
  23. protected virtual void OnButton1Clicked (object sender, System.EventArgs e)
  24. {
  25. mySerial new SerialPort("/dev/ttyS0", 9600, None, 8, Two);
  26. }
  27. }

Me da error en la línea 25. ¿Qué puede ser?

Estoy intentando pasar este código de Visual C# a Mono, puedes ver el código en las páginas 153 y 154 en este manual en PDF.

http://www.abcdatos.com/tutoriales/tutorial/z9521.html

Saludos.

EDITO:
He logrado abrir el puerto pero no he sido enviar el código al puerto serie.
Código
  1. // MainWindow.cs created with MonoDevelop
  2. // User: metaconta at 17:46 23/02/2009
  3. //
  4. // To change standard headers go to Edit->Preferences->Coding->Standard Headers
  5. //
  6. using System;
  7. using Gtk;
  8. using System.IO.Ports;
  9.  
  10. public partial class MainWindow: Gtk.Window
  11. {
  12. private SerialPort mySerial;
  13.  
  14. public MainWindow (): base (Gtk.WindowType.Toplevel)
  15. {
  16. Build ();
  17. }
  18.  
  19. protected void OnDeleteEvent (object sender, DeleteEventArgs a)
  20. {
  21. Application.Quit ();
  22. a.RetVal = true;
  23. }
  24.  
  25. protected virtual void OnButton1Clicked (object sender, System.EventArgs e)
  26. {
  27. mySerial = new SerialPort("/dev/ttyS0", 9600, Parity.None, 8, StopBits.Two);
  28.  
  29. if(mySerial == null) return;
  30.  
  31. mySerial.Open();
  32.  
  33. if(!mySerial.IsOpen)
  34. {
  35. label1.Text = "Error abriendo";
  36. mySerial.Dispose();
  37. return;
  38. }
  39.  
  40. byte[] buffer = new byte[1];
  41. buffer[0] = 0x74;
  42. mySerial.Write(buffer, 0, 1);
  43.  
  44. try
  45. {
  46. mySerial.Write(buffer, 0, 1);
  47. }
  48. catch(Exception ex)
  49. {
  50. //label1.Text = ex.Message;// + " " + ex.StackTrace;
  51. mySerial.Close();
  52. mySerial.Dispose();
  53. return;
  54. }
  55.  
  56. mySerial.Close();
  57. }
  58. }

Un cordial saludo.
2110  Programación / .NET (C#, VB.NET, ASP) / DE Visual C++ a Visual C#... en: 10 Febrero 2009, 23:00 pm
Hola:

Intentando pasar de VC# a VC++ esta parte que parece que no sirve.

Código
  1. 1 using System;
  2. 2 using System.Collections.Generic;
  3. 3 using System.ComponentModel;
  4. 4 using System.Data;
  5. 5 using System.Drawing;
  6. 6 using System.Linq;
  7. 7 using System.Text;
  8. 8 using System.Windows.Forms;
  9. 9 using System.IO.Ports;
  10. 10
  11. 11 namespace PicRS232
  12. 12 {
  13. 13    public partial class Form1_Principal : Form
  14. 14    {
  15. 15        // Utilizaremos un string como buffer de recepcion
  16. 16        string Recibidos;
  17. 17        public Form1_Principal()
  18. 18        {
  19. 19            InitializeComponent();
  20. 20            // Abrir puerto mientra se ejecute la aplicación
  21. 21            if (!serialPort1.IsOpen)
  22. 22            {
  23. 23                try
  24. 24                {
  25. 25                    serialPort1.Open();
  26. 26                }
  27. 27                catch (System.Exception ex)
  28. 28                {
  29. 29                    MessageBox.Show(ex.ToString());
  30. 30                }
  31. 31            }
  32. 32            // Ejecutar la funcion Recepcion por disparo del Evento 'DataReived'
  33. 33            serialPort1.DataReceived += new
  34. 34            System.IO.Ports.SerialDataReceivedEventHandler(Recepcion);
  35. 35        }
  36. 36        // Al recibir los datos
  37. 37        private void Recepcion(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)
  38. 38        {
  39. 39            // Acumular los carácteres recibidos a nuestro 'buffer' (string)
  40. 40            Recibidos += serialPort1.ReadExisting();
  41. 41            // Invocar o llamar al proceso de tramas
  42. 42            this.Invoke(new EventHandler(Actualizar));
  43. 43        }
  44. 44        // Procesar los datos recibidos en el buffer y extraer tramas completas
  45. 45        private void Actualizar(object s, EventArgs e)
  46. 46        {
  47. 47            // Asignar el valor de la trama al textBox
  48. 48            textBox_visualizar_mensaje.Text = Recibidos;
  49. 49        }
  50. 50        private void button_t_Click(object sender, EventArgs e)
  51. 51        {
  52. 52            byte[] mBuffer = new byte[1];
  53. 53            mBuffer[0] = 0x74; //ASCII letra "t".
  54. 54            serialPort1.Write(mBuffer, 0, mBuffer.Length);
  55. 55        }
  56. 56
  57. 57        private void button_b_Click(object sender, EventArgs e)
  58. 58        {
  59. 59            byte[] miBuffer = new byte[1];
  60. 60            miBuffer[0] = 0x62; //ASCII letra "b".
  61. 61            serialPort1.Write(miBuffer, 0, miBuffer.Length);
  62. 62        }
  63. 63
  64. 64        private void button_a_Click(object sender, EventArgs e)
  65. 65        {
  66. 66            byte[] mBuffer = new byte[1];
  67. 67            mBuffer[0] = 0x61; //ASCII letra "a".
  68. 68            serialPort1.Write(mBuffer, 0, mBuffer.Length);
  69. 69        }
  70. 70
  71. 71        private void button_l_Click(object sender, EventArgs e)
  72. 72        {
  73. 73            byte[] mBuffer = new byte[1];
  74. 74            mBuffer[0] = 0x6C; //ASCII letra "l".
  75. 75            serialPort1.Write(mBuffer, 0, mBuffer.Length);
  76. 76        }
  77. 77
  78. 78        private void button_Espacio_Click(object sender, EventArgs e)
  79. 79        {
  80. 80            byte[] mBuffer = new byte[1];
  81. 81            mBuffer[0] = 0x20; //ASCII letra "Espacio".
  82. 82            serialPort1.Write(mBuffer, 0, mBuffer.Length);
  83. 83        }
  84. 84
  85. 85        private void timer1_Tick(object sender, EventArgs e)
  86. 86        {
  87. 87            statusStrip1.Items[0].Text = DateTime.Now.ToLongTimeString();
  88. 88        }
  89. 89    }
  90. 90 }

Código completo de Visual C# Express. Descargar aquí.

Por ahora he hecho el código en Visual C++ pero me faltan hacer cosas que no he incuido.
Código
  1. 1 #pragma once
  2. 2
  3. 3
  4. 4 namespace PicRS232VCPP_Prueba01 {
  5. 5
  6. 6    using namespace System;
  7. 7    using namespace System::ComponentModel;
  8. 8    using namespace System::Collections;
  9. 9    using namespace System::Windows::Forms;
  10. 10    using namespace System::Data;
  11. 11    using namespace System::Drawing;
  12. 12    using namespace System::IO::Ports;
  13. 13
  14. 14    /// <summary>
  15. 15    /// Resumen de Form1
  16. 16    ///
  17. 17    /// ADVERTENCIA: si cambia el nombre de esta clase, deberá cambiar la
  18. 18    ///          propiedad 'Nombre de archivos de recursos' de la herramienta de compilación de recursos administrados
  19. 19    ///          asociada con todos los archivos .resx de los que depende esta clase. De lo contrario,
  20. 20    ///          los diseñadores no podrán interactuar correctamente con los
  21. 21    ///          recursos adaptados asociados con este formulario.
  22. 22    /// </summary>
  23. 23    public ref class Form1 : public System::Windows::Forms::Form
  24. 24    {
  25. 25    public:
  26. 26        Form1(void)
  27. 27        {
  28. 28            InitializeComponent();
  29. 29            //
  30. 30            //TODO: agregar código de constructor aquí
  31. 31            //
  32. 32            // Abrir puerto mientrase ejecute la aplicación
  33. 33            if(!serialPort1->IsOpen)
  34. 34            {
  35. 35                try
  36. 36                {
  37. 37                serialPort1->Open();
  38. 38                }
  39. 39                catch (Exception ^ex)
  40. 40                {
  41. 41                    MessageBox::Show(ex->ToString());
  42. 42                }
  43. 43            }
  44. 44        }
  45. 45
  46. 46    protected:
  47. 47        /// <summary>
  48. 48        /// Limpiar los recursos que se estén utilizando.
  49. 49        /// </summary>
  50. 50        ~Form1()
  51. 51        {
  52. 52            if (components)
  53. 53            {
  54. 54                delete components;
  55. 55            }
  56. 56        }
  57. 57    private: System::Windows::Forms::Button^  button_t;
  58. 58    private: System::Windows::Forms::Button^  button_b;
  59. 59    private: System::Windows::Forms::Button^  button_a;
  60. 60    private: System::Windows::Forms::Button^  button_l;
  61. 61    private: System::Windows::Forms::Button^  button_Espacio;
  62. 62    private: System::IO::Ports::SerialPort^  serialPort1;
  63. 63    private: System::ComponentModel::IContainer^  components;
  64. 64
  65. 65    protected:  
  66. 66
  67. 67    private:
  68. 68        /// <summary>
  69. 69        /// Variable del diseñador requerida.
  70. 70        /// </summary>
  71. 71
  72. 72
  73. 73 #pragma region Windows Form Designer generated code
  74. 74        /// <summary>
  75. 75        /// Método necesario para admitir el Diseñador. No se puede modificar
  76. 76        /// el contenido del método con el editor de código.
  77. 77        /// </summary>
  78. 78        void InitializeComponent(void)
  79. 79        {
  80. 80            this->components = (gcnew System::ComponentModel::Container());
  81. 81            this->button_t = (gcnew System::Windows::Forms::Button());
  82. 82            this->button_b = (gcnew System::Windows::Forms::Button());
  83. 83            this->button_a = (gcnew System::Windows::Forms::Button());
  84. 84            this->button_l = (gcnew System::Windows::Forms::Button());
  85. 85            this->button_Espacio = (gcnew System::Windows::Forms::Button());
  86. 86            this->serialPort1 = (gcnew System::IO::Ports::SerialPort(this->components));
  87. 87            this->SuspendLayout();
  88. 88            //  
  89. 89            // button_t
  90. 90            //  
  91. 91            this->button_t->Location = System::Drawing::Point(109, 38);
  92. 92            this->button_t->Name = L"button_t";
  93. 93            this->button_t->Size = System::Drawing::Size(75, 23);
  94. 94            this->button_t->TabIndex = 0;
  95. 95            this->button_t->Text = L"t";
  96. 96            this->button_t->UseVisualStyleBackColor = true;
  97. 97            this->button_t->Click += gcnew System::EventHandler(this, &Form1::button_t_Click);
  98. 98            //  
  99. 99            // button_b
  100. 100            //  
  101. 101            this->button_b->Location = System::Drawing::Point(109, 67);
  102. 102            this->button_b->Name = L"button_b";
  103. 103            this->button_b->Size = System::Drawing::Size(75, 23);
  104. 104            this->button_b->TabIndex = 1;
  105. 105            this->button_b->Text = L"b";
  106. 106            this->button_b->UseVisualStyleBackColor = true;
  107. 107            this->button_b->Click += gcnew System::EventHandler(this, &Form1::button_b_Click);
  108. 108            //  
  109. 109            // button_a
  110. 110            //  
  111. 111            this->button_a->Location = System::Drawing::Point(28, 67);
  112. 112            this->button_a->Name = L"button_a";
  113. 113            this->button_a->Size = System::Drawing::Size(75, 23);
  114. 114            this->button_a->TabIndex = 2;
  115. 115            this->button_a->Text = L"a";
  116. 116            this->button_a->UseVisualStyleBackColor = true;
  117. 117            this->button_a->Click += gcnew System::EventHandler(this, &Form1::button_a_Click);
  118. 118            //  
  119. 119            // button_l
  120. 120            //  
  121. 121            this->button_l->Location = System::Drawing::Point(190, 67);
  122. 122            this->button_l->Name = L"button_l";
  123. 123            this->button_l->Size = System::Drawing::Size(75, 23);
  124. 124            this->button_l->TabIndex = 3;
  125. 125            this->button_l->Text = L"l";
  126. 126            this->button_l->UseVisualStyleBackColor = true;
  127. 127            this->button_l->Click += gcnew System::EventHandler(this, &Form1::button_l_Click);
  128. 128            //  
  129. 129            // button_Espacio
  130. 130            //  
  131. 131            this->button_Espacio->BackColor = System::Drawing::Color::FromArgb(static_cast<System::Int32>(static_cast<System::Byte>(255)), static_cast<System::Int32>(static_cast<System::Byte>(128)),  
  132. 132                static_cast<System::Int32>(static_cast<System::Byte>(0)));
  133. 133            this->button_Espacio->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 8.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,  
  134. 134                static_cast<System::Byte>(0)));
  135. 135            this->button_Espacio->Location = System::Drawing::Point(190, 96);
  136. 136            this->button_Espacio->Name = L"button_Espacio";
  137. 137            this->button_Espacio->Size = System::Drawing::Size(75, 23);
  138. 138            this->button_Espacio->TabIndex = 4;
  139. 139            this->button_Espacio->Text = L"Espacio";
  140. 140            this->button_Espacio->UseVisualStyleBackColor = false;
  141. 141            this->button_Espacio->Click += gcnew System::EventHandler(this, &Form1::button_Espacio_Click);
  142. 142            //  
  143. 143            // serialPort1
  144. 144            //  
  145. 145            this->serialPort1->StopBits = System::IO::Ports::StopBits::Two;
  146. 146            //  
  147. 147            // Form1
  148. 148            //  
  149. 149            this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
  150. 150            this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
  151. 151            this->ClientSize = System::Drawing::Size(292, 266);
  152. 152            this->Controls->Add(this->button_Espacio);
  153. 153            this->Controls->Add(this->button_l);
  154. 154            this->Controls->Add(this->button_a);
  155. 155            this->Controls->Add(this->button_b);
  156. 156            this->Controls->Add(this->button_t);
  157. 157            this->Name = L"Form1";
  158. 158            this->StartPosition = System::Windows::Forms::FormStartPosition::CenterScreen;
  159. 159            this->Text = L"PicRS232VCPP";
  160. 160            this->ResumeLayout(false);
  161. 161
  162. 162        }
  163. 163 #pragma endregion
  164. 164    private: System::Void button_t_Click(System::Object^  sender, System::EventArgs^  e) {
  165. 165                 cli::array<unsigned char> ^uno = gcnew cli::array<unsigned char>(1);
  166. 166                 uno[0] = 0x74; //ASCII letra "t".
  167. 167                 serialPort1->Write(uno, 0, 1);
  168. 168             }
  169. 169 private: System::Void button_b_Click(System::Object^  sender, System::EventArgs^  e) {
  170. 170                 cli::array<unsigned char> ^uno = gcnew cli::array<unsigned char>(1);
  171. 171                 uno[0] = 0x62; //ASCII letra "b".
  172. 172                 serialPort1->Write(uno, 0, 1);
  173. 173         }
  174. 174 private: System::Void button_a_Click(System::Object^  sender, System::EventArgs^  e) {
  175. 175             cli::array<unsigned char> ^uno = gcnew cli::array<unsigned char>(1);
  176. 176                 uno[0] = 0x61; //ASCII letra "a".
  177. 177                 serialPort1->Write(uno, 0, 1);
  178. 178         }
  179. 179 private: System::Void button_l_Click(System::Object^  sender, System::EventArgs^  e) {
  180. 180             cli::array<unsigned char> ^uno = gcnew cli::array<unsigned char>(1);
  181. 181                 uno[0] = 0x6C; //ASCII letra "l".
  182. 182                 serialPort1->Write(uno, 0, 1);
  183. 183         }
  184. 184 private: System::Void button_Espacio_Click(System::Object^  sender, System::EventArgs^  e) {
  185. 185             cli::array<unsigned char> ^uno = gcnew cli::array<unsigned char>(1);
  186. 186                 uno[0] = 0x20; //ASCII letra "Espacio".
  187. 187                 serialPort1->Write(uno, 0, 1);
  188. 188         }
  189. 189 };
  190. 190 }
  191. 191
   


Saludos.
Páginas: 1 ... 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 [211] 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 ... 255
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines