30 Ekim 2016 Pazar

c# konsol ile seriportan veri okuma

using System;
using System.IO.Ports;

class PortDataReceived
{
    public static void Main()
    {
        SerialPort mySerialPort = new SerialPort("COM4"); // buraya seriportunuzun comunda değişiklik yapmayı unutmayınız 

        mySerialPort.BaudRate = 9600;
        mySerialPort.Parity = Parity.None;
        mySerialPort.StopBits = StopBits.One;
        mySerialPort.DataBits = 8;
        mySerialPort.Handshake = Handshake.None;
        mySerialPort.RtsEnable = true;

        mySerialPort.DataReceived += new SerialDataReceivedEventHandler(DataReceivedHandler);

        mySerialPort.Open();

        Console.WriteLine("herhangi bir tuşa bas!");
        Console.WriteLine();
        Console.ReadKey();
        mySerialPort.Close();
    }

    private static void DataReceivedHandler(
                        object sender,
                        SerialDataReceivedEventArgs e)
    {
        SerialPort sp = (SerialPort)sender;
        string indata = sp.ReadExisting();
       
        Console.Write(indata);
    }
}


Pic ile gonderilen verinin  consol aracılığıyla okunması için gerekli kodlar yukarıdaki gibidir.

3 Eylül 2016 Cumartesi

Ccs Pic timer0 Application For 16F628A

I wanna explain how to use timer0 interrupts for 16f628a microprocessor..First time coding timer0 is difficult for me.At that time I have investigated timer0 .Actually it so easy .May be it is different than 16f877a etc.But it s so simply

Here We Go :


#include "E:\ENGİNEERİNG\MİCRO DENETLEYİCİLER\çalışmalarım 6\628a deneme\2\timer0 kesmesi"

#include <16f628a .h="">
#FUSES NOWDT                    //No Watch Dog Timer
#FUSES xt                       //Crystal  Osc with CLKOUT
#FUSES NOPUT                    //No Power Up Timer
#FUSES NOCPD                    //No EE protection

#use delay(clock=4000000)

#use fast_io(b)
#use fast_io(a)

int i=0;

#int_rtcc     // tmer0  kesmesini bu sekilde tanımlıyoruz 628a da
rtcc_isr( )
{
set_timer0(60);
i++;
if(i==40)
{
output_high(pin_b7);
delay_ms(100);
output_low(pin_b7);
delay_ms(10);
i=0;

}


}


void main()

{

   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_256);

   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DISABLED,0,1);
   setup_comparator(NC_NC_NC_NC);
   setup_vref(FALSE);
//Setup_Oscillator parameter not selected from Intr Oscillator Config tab

   // TODO: USER CODE!!

set_tris_b(0x01);
set_tris_a(0xff);
output_a(0x00);
output_b(0x00);


 set_timer0(60); // TMR0 değeri belirleniyor


 while(1){


 enable_interrupts(INT_timer0); // int_timer0 kesmesini aktif yapar

 enable_interrupts(GLOBAL);


 }


}


IF YOU DEFıNE TİMER0 ; as the  following

#int_timer0
void timer0 ()
{

set_timer0(60)

}

this codes are not working


I hope this code list can be  usefull and beneficial for you






31 Ağustos 2016 Çarşamba

C# da web browser yazmak


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WindowsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            object a=null;

            axWebBrowser1.Navigate(textBox1.Text, ref a, ref a, ref a, ref a);

        }

        private void button2_Click(object sender, EventArgs e)
        {
            axWebBrowser1.GoBack();

        }

        private void button3_Click(object sender, EventArgs e)
        {
            axWebBrowser1.GoForward();

        }

        private void button4_Click(object sender, EventArgs e)
        {
            textBox1.Text = "www.google.com.tr";
        
            axWebBrowser1.Navigate(textBox1.Text);

        
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            textBox1.Text = "www.abdurrahmantunc.blogspot.com";
            button1.Text = "git";
            button2.Text = "ileri";
            button3.Text = "geri";
            button4.Text = "ana sayfa";

        }
    }



}