member_tdh said:Hi all member!
Now, I want to communication with PC by Serial Port, NOT USE MAX232.
Has anybody any idea?
Could anybody share experience...? Thanks!
:idea:
member_tdh said:Hi all member!
Now, I want to communication with PC by Serial Port, NOT USE MAX232.
Has anybody any idea?
Could anybody share experience...? Thanks!
:idea:
sn_burki said:It depends that what type of function is required? I have used transistors not max in my atmel programmer.
thanks to current RS-232 implementation and the excellent I/O specifications of the PICmicro, most applications don't require level converters. Rather, inverted TTL (N300..N9600) can be used. A current limiting resistor is suggested (RS-232 is suppose to be short-tolerant)
chrismicro said:I have done many projects, communicating with PC from a PIC direct with only a 22K resistor in the TX line and a 1K in the RX line with success, one thing to remember is, a PC send and receive in reverse polarity "Driven Inverted",thanks to current RS-232 implementation and the excellent I/O specifications of the PICmicro, most applications don't require level converters. Rather, inverted TTL (N300..N9600) can be used. A current limiting resistor is suggested (RS-232 is suppose to be short-tolerant)
funnynypd said:chrismicro said:I have done many projects, communicating with PC from a PIC direct with only a 22K resistor in the TX line and a 1K in the RX line with success, one thing to remember is, a PC send and receive in reverse polarity "Driven Inverted",thanks to current RS-232 implementation and the excellent I/O specifications of the PICmicro, most applications don't require level converters. Rather, inverted TTL (N300..N9600) can be used. A current limiting resistor is suggested (RS-232 is suppose to be short-tolerant)
This may work for most of today's PC. For some old ones, it still required high threadhold...
member_tdh said:Hi all member!
Now, I want to communication with PC by Serial Port, NOT USE MAX232.
Has anybody any idea?
Could anybody share experience...? Thanks!
:idea:
'****************************************************************
'* Name : Gate.BAS *
'* Author : Chris Bezuidenhout *
'* Notice : Copyright (c) 2005 Micro Developments *
'* : All Rights Reserved *
'* Date : 2005/09/17 *
'* Version : 1.0 *
'* Notes : *
'* URL :[I]**broken link removed**[/I] *
'****************************************************************
INCLUDE "modedefs.bas" ' Include serial modes
DEFINE OSC 4 ' Set IRC Frequency
DEFINE DEBUG_BAUD 2400
DEFINE DEBUG_MODE 1
DEFINE DEBUG_REG PORTA
DEFINE DEBUG_BIT 3
Fam1 var byte
Fam2 var byte
CRC1 var byte
CRC2 var byte
Code1 var byte[6] 'aray variable met 6 komponente
Q1 var byte
Flag var byte
Excess var byte
X var byte
W var byte
rxbyte var byte
txbyte var byte
Gate var byte
Hek1 var PORTB.3
Hek2 var PORTB.4
Lees1 var PORTb.2
Lees2 var PORTB.0
GRN1 var PORTA.0
Rooi1 var PORTA.1
GRN2 var PORTB.6
Rooi2 var PORTB.7
Dout var PORTb.1 'verander terug na A.3
Din var PORTb.3 'verander terug na A.4
' CMCON = 7 'Set port a to general I/O on 16F628
' TRISA = %00110100
' TRISB = %00000011
TRISA = %00100000
TRISB = %00000010 '******************************vernder bit 7 na 0
' OPTION_REG = $7f ' Enable PORTB pullups
pause 500
' test:
' hek2 = %1 'Rooi LED af
' pause 200
' hek2 = %0
' pause 200
'' low grn2
'' high rooi2
'' low hek2
'' pause 100
'' portb = 255
'' porta = 255
'' pause 200
'' portb = 0
'' porta = 0
'' pause 200
' goto test
Main:
LOW rooi1
HIGH grn1
Hek1 = %0
Hek2 = %0
High rooi2
low grn2
Fam1=$FF
Fam2=$FF
crc1=$FF
Excess=$FF
for x=0 to 5
code1[X]=$FF
next x
OWOUT Lees1,%001,[$33] 'Stuur 33 HEX na adres 1 om IButton in transmit mode te sit
OWIN Lees1,%000,[Fam1,STR Code1\6,crc1] 'Lees IButton se kode
'***************************haal uiit
' if portb.7 =0 then
' for x = 0 to 6
' lookup x,[$E4,$1C,$31,$46,$0F,$00,$00],w 'Control iButton code witte
'' lookup x,[$dd,$85,$42,$0e,0,0],w 'Control iButton code Barry
' 'write x,w
' code1[X]=w
' Next x
' else
' goto main
' endif
' fam1=$01
'***********************************************
if fam1=$01 then Gate1
OWOUT Lees2,%001,[$33] 'Stuur 33 HEX na adres 1 om IButton in transmit mode te sit
OWIN Lees2,%000,[Fam2,STR Code1\6,crc1] 'Lees IButton se kode
' for x = 1 to 10
' serout DOUT,N2400,["A",code1[5],code1[4],code1[3],code1[2],code1[1],code1[0],crc1]
' next x
' pause 1000
' goto main
'Gebruik famielie kode as flag dat iButton teenwoordig is
if fam2=$01 then Gate2
'2400 Baud word hier gebruik in omgekeerde polariteit "N2400", "T2400" as jy met ander PIC kommunikeer
'maar ek beveel 20MHz aan vir hoer baud rate maar sal werk op 9600 met 4MHz
' Serin DIN,N2400,1000,main,["SS"],Excess '"SS" is stelsel se ID en kan verander vir ander stelsel
' 'maar moet ook verander in program wat op PC loop
' if Excess ="X" then gate2 'As "X" ontvang is, is iButton geldig en word toegang verleen
goto Main 'Loop if iButton not present
'END
Gate1:
' for x=1 to 3 'indien kode per radio gestuur word is dit beter om drie keer te stuur
'Stuur kode na PC program om gebruiker te identifiseer, "STR Code1" aray word hier
'opgebreek en 6 komponente afsonderlik in tru orde na PC program gestuur + CRC byte
for x = 5 to 0 step -1
write x,code1(x)
next x
serout DOUT,N2400,[1,code1[5],code1[4],code1[3],code1[2],code1[1],code1[0],crc1]
' serout2 Dout,16780,[1,hex2 code1[5],hex2 code1[4],hex2 code1[3],hex2 code1[2],hex2 code1[1],hex2 code1[0],hex2 crc1]
' next x
' debug 1,HEX code1[5],HEX2 code1[4],HEX2 code1[3],HEX2 code1[2],HEX2 code1[1],HEX2 code1[0],HEX2 crc1
Acnlg1:
Serin DIN, N2400, 1000, main,["SS"],Excess 'Wag hier vir data vanaf PC om toegang te verleen
Select case excess
Case "A"
goto acnlg1
case "D"
goto Buzzer 'Skakel Buzzer aan indien iButton nie erken is nie
case "E"
GLED1:
Hek1 = %1 'Skakel relay om hek oop te maak
high rooi1 'Groen LED aan
low grn1 'Rooi LED af
pause 3000 'wag 3 sekondes
'
RLED1:
Hek1 = %0 'Los relay om hek te sluit nadat mikro gepuls is
LOW rooi1 'Groen LED af
HIGH grn1 'Rooi LED aan
case else
GOTO MAIN
end select
goto main 'Keer terug na main loop
'******************Indien tweede hek benodig word****************
Gate2:
serout DOUT,N2400,[2,code1[5],code1[4],code1[3],Code1[2],code1[1],code1[0],crc1]
Acnlg2:
Serin DIN,N2400, 1000, main,["SS"],Excess 'Wag hier vir data vanaf PC om toegang te verleen
'goto Main
Select case excess
Case "A"
Excess =$FF
goto acnlg2
case "D"
goto Buzzer 'Skakel Buzzer aan indien iButton nie erken is nie
case "E"
GLED2:
'test:
hek2 = %1
' low rooi2
' High grn2 'Rooi LED af
pause 3000
hek2 = %0
high rooi2
low grn2
'' low grn2
'' high rooi2
'' low hek2
'' pause 100
'' portb = 255
'' porta = 255
'' pause 200
'' portb = 0
'' porta = 0
'' pause 200
' goto test
'Los relay om hek te sluit nadat mikro gepuls is
LOW rooi2 'Groen LED af
HIGH grn2 'Rooi LED aan
case else
GOTO MAIN
end select
goto main
'****************************************************************
Buzzer:
for X = 1 to 5
high rooi1
low grn1
pause 250
LOW rooi1
HIGH grn1
next x
goto Main
end
data "SS" 'EEPROM data stelsel ID
member_tdh said:Hi all member!
Now, I want to communication with PC by Serial Port, NOT USE MAX232.
Has anybody any idea?
Could anybody share experience...? Thanks!
:idea:
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?