caramoan tour package

caramoan tour package

Author Topic: Problem on UART SENDING DATA in BITS  (Read 1013 times)

Offline reaver26

  • Size AAA Battery
  • ***
  • Posts: 99
  • Pogi/Ganda Points: 0
  • Gender: Male
Problem on UART SENDING DATA in BITS
« on: February 20, 2010, 12:31:04 AM »
c ???urrently our project can send and receive data over UART interfacing MCU and PC.

data transmission from MCU to PC 1st PROCESS no PROBLEm

2nd process nagkakaproblema na po..

ex.

keypad inputs are: "123456" # as for enter key
MCU transmit that data over uart into VB.net receiving string length = 6

i inputted a string that will be send also over UART from MCU to VB.net ang problem

hindi nya ma send ang whole string length  "PIN CODE is CORRECT"

instead ang na send nya lang is "PIN CODE is" which the string length = 11
karugtong "CORRECT" string lenght = 7

bakit po ganun mga masters?

paano ko po ma send over UART exact string length na hindi napuputol according sa declaration ng string?

kasi po ganito ang sequence ng input...

the pincode is analyze on a textbox sa vb.net(PC)

condition statement kasi sa vb.net
kapag ma receive and 6digit pin code. e analyze sa database sa PC then if that pincode matches on the specific persoon
it will reply correct.. if not reply incorrect.


ang nangyari sa sending ng data namin.....
1st input ng pincode... ok naman ang pag recieve.
pero 2nd input napuputol thus ang string ng data is incomplete kaya di ma determine correct pincode...

minsan 1st send sa group ng pincode na ito "123456"
1st send: "123"
karugtong nya "456"

reply talaga sya error....




Philippine Electronics Forum

Problem on UART SENDING DATA in BITS
« on: February 20, 2010, 12:31:04 AM »

Offline reaver26

  • Size AAA Battery
  • ***
  • Posts: 99
  • Pogi/Ganda Points: 0
  • Gender: Male
Re: Problem on UART SENDING DATA in BITS
« Reply #1 on: February 20, 2010, 02:29:56 AM »
MCU current code:
http://codepad.org/ootXDBK0

UART CODE:
Code: [Select]
#include <pic.h>

void putch(unsigned char byte)
{
while(!TXIF) //if TXIF is cleared, wait till
; //previous byte is sent
TXREG = byte; //then send bytes
}

void puts(const unsigned char *s)
{
while(*s)
{
// while(!TXIF);
putch(*s++);
}
}

void init_UART(void)
{
BRGH = 1; //high-speed
// SPBRG = 25; //9600 baud/s at 4 mhz
SPBRG = 129; //9600 baud/s at 20 mhz

TX9 = 0; //8-bit data
RX9 = 0;

SYNC = 0; //set UART in asynchronouse mode
SPEN = 1; //enable serial port
CREN = 1; //enable continuous receive mode
// RCIE = 1; //enable Rx interrupt
// TXIE = 0; //enable Tx interrupt
TXEN = 1; //enable Transmit
// PEIE = 1; //enable peripheral interrupt
// GIE = 1;
}




Photos of error for reference: (STRING RECIEVED : STRING LENGTH)
im trying to input "247508" if the VB.net will receive the correct string sequence it should reply "PIN CODE IS CORRECT"

whats seems to be the problem on my code? and how can i send the data in complete string that the VB will read it as a whole.

not by PARTS?











Philippine Electronics Forum

Re: Problem on UART SENDING DATA in BITS
« Reply #1 on: February 20, 2010, 02:29:56 AM »

Offline zer0w1ng

  • Technical People
  • Gas Turbine
  • *****
  • Posts: 2179
  • Pogi/Ganda Points: 305
  • Gender: Male
  • Enter any 11-digit prime number to continue...
    • The Cebuano Geek
Re: Problem on UART SENDING DATA in BITS
« Reply #2 on: February 20, 2010, 08:52:27 AM »
Ang PC program mo ang may problem.
It should do framing of data received or add a timeout to restart the reception.
The Cebuano Geek

Philippine Electronics Forum

Re: Problem on UART SENDING DATA in BITS
« Reply #2 on: February 20, 2010, 08:52:27 AM »

Offline reaver26

  • Size AAA Battery
  • ***
  • Posts: 99
  • Pogi/Ganda Points: 0
  • Gender: Male
Re: Problem on UART SENDING DATA in BITS
« Reply #3 on: February 20, 2010, 11:55:42 AM »
Ang PC program mo ang may problem.
It should do framing of data received or add a timeout to restart the reception.

sir zerowing... na resolve na po... timeout po ang problem sa serialport properties... naka "-1" pinalitan namin ng "1"

sir anghel_7 help me..

waiting na lang ang MCU kung anong character e send sa kanya... di ko na papa reply ang MCU ng succeeding string like
"PIN CODE IS CORRECT" or such.......

yung 10mins tine inidicator sa vb ko na lang pagagalawin...

it means maging switch na lang ang  MCU.

all the processes nasa vb.

as for now mga masters

yan pa muna mga problems ang conclusions namin...

the moment tapos na ang prototype namin.. post po ako dito ng photos.

without your help and suggestions we cannot make this thesis to work...

sir paranz, sir 7, sir marcellino and to you sir zero wing thank you for now.....

wish us luck on our final defense....

we are the pioneering 4yrs IT graduating students of ACLC GENSAN

 i know malayo ang thesis namin sa field namin.....

Philippine Electronics Forum

Re: Problem on UART SENDING DATA in BITS
« Reply #3 on: February 20, 2010, 11:55:42 AM »

Offline motion55

  • Technical People
  • Diesel Generator
  • *****
  • Posts: 1882
  • Pogi/Ganda Points: 244
  • Gender: Male
  • Been at this longer than you've been alive.
Re: Problem on UART SENDING DATA in BITS
« Reply #4 on: February 20, 2010, 02:44:10 PM »
Quote
it means maging switch na lang ang  MCU.

all the processes nasa vb.

In your defense, this is the normal practice. Imagine if the box with the MCU is exposed to the burglar. Then babaklasin lang ng magnanakaw ang box and short a few wires and it will open the door, like sa movies. Ideally the device that will actually open the door, be it a PC or whatever, must be within a secure area. What is exposed is simply the switch to input the code.
"Set your mind free!"

Philippine Electronics Forum

Re: Problem on UART SENDING DATA in BITS
« Reply #4 on: February 20, 2010, 02:44:10 PM »

Offline 0b00000111

  • Technical People
  • Solar Power Satellite
  • *****
  • Posts: 6129
  • Pogi/Ganda Points: 398
  • There is no delight in owning anything unshared.
Re: Problem on UART SENDING DATA in BITS
« Reply #5 on: February 20, 2010, 03:24:29 PM »
timeout po ang problem sa serialport properties... naka "-1" pinalitan namin ng "1"

taasan mo ng konti ang value ng ReadTimeOutProperty... gawin mong mga 10 (10milliseconds), baka di umabot in case pumiyok ng konti ang PIC (worst case) while sending the string  at mag cause ng exception sa VB.NET program mo... 9600bps is near 1milliseconds  (10*1/9600 = 1.04msec)  isang buong frame so dapat medyo may allowance ;)
E-Gizmo Mechatronix Central: www.e-gizmo.com

Tel #: (63)(2) 536-3378
Globe +63915-973-7691
Smart +63921-779-0748

Location Map

YM: julie.egizmo  aka Born2BeWired  ;D

Offline reaver26

  • Size AAA Battery
  • ***
  • Posts: 99
  • Pogi/Ganda Points: 0
  • Gender: Male
Re: Problem on UART SENDING DATA in BITS
« Reply #6 on: February 20, 2010, 10:47:29 PM »
taasan mo ng konti ang value ng ReadTimeOutProperty... gawin mong mga 10 (10milliseconds), baka di umabot in case pumiyok ng konti ang PIC (worst case) while sending the string  at mag cause ng exception sa VB.NET program mo... 9600bps is near 1milliseconds  (10*1/9600 = 1.04msec)  isang buong frame so dapat medyo may allowance ;)

kakauwi lang po... problems noticed sa system... meron sequence na napapansin kami kanina..

ex:
input kami sa keypad ng 247508. rcv ng Vb "CORRECT"
sa 2nd and 3rd input namin accept nya parin na correct.. kahit mali na set of keys ang pindot namin.
on the 4th atempt... tama na ulit ang reply nya na "INCORRECT"

i used.
serialPort.DiscardInBuffer();
serialPort.DiscardOutBuffer();

thinking it would clear the buffer which caused delay transmission... still ganun parin...

better na ngayon kasi alam ko after 1st correct entry... tinatanggap ng entry sa vb at my confirmation na correct.. pero MCU replies 2 more consecuitive after the last working transmission...

hmmm we think that ang mcu hndi nag clear ng buffer..

any opinion po?

Philippine Electronics Forum

Re: Problem on UART SENDING DATA in BITS
« Reply #6 on: February 20, 2010, 10:47:29 PM »

 

Privacy Policy

Contact Us: elabph@yahoo.com