Quantcast
Channel: MCS Electronics Forum
Viewing all 20606 articles
Browse latest View live

BASCOM-AVR : Fastest IC : REPLY

$
0
0
One important factor is VCC max. Atmega up to 5.5V, ATXMEGA up to 3.6V. Lower VCC works with lower frequency (see data sheet). If the interfaced device is at a differing voltage, then you need voltage level converters. Regards Hubert

BASCOM-AVR : Fastest IC : REPLY

$
0
0
One important factor is VCC max. Atmega up to 5.5V, ATXMEGA up to 3.6V. Lower VCC works with lower frequency (see data sheet). If the interfaced device is at a differing voltage, then you need voltage level converters. Regards Hubert

BASCOM-AVR : card reader : REPLY

$
0
0
then I had the confirmation that the data must be sent in hexadecimal ... the command is correct, because if I send with REALTERM 0X02 0X00 0X02 0X33 0X30 0X03 0X00 and then 0x05 it works! I have to do the same thing with BASCOM ... this is the code I tried but it does not work ... ? [code:1:8776cddb92] $regfile = "m1284def.dat" $crystal = 16000000 $baud = 19200 $hwstack = 40 $swstack = 40 $framesize = 40 Config Com2 = 9600 , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0 Open "COM2:" For Binary As #2 'open channel Dim Crtcmd(16) As Byte enable interrupts Crtcmd(1) = &H02 Crtcmd(2) = &H00 Crtcmd(3) = &H02 Crtcmd(4) = &H33 Crtcmd(5) = &H30 Crtcmd(6) = &H03 Crtcmd(7) = &H00 Printbin #2 , Crtcmd(1) ; 7 Wait 2 Crtcmd(1) = &H05 Printbin #2 , Crtcmd(1) ; 1 Wait 2 Do Loop End [/code:1:8776cddb92]

BASCOM-AVR : card reader : REPLY

$
0
0
I put the driver is not working ... but maybe I understood what happens: I tried connecting to the pc ... send this: Crtcmd (1) = & H02 Crtcmd (2) = & H00 Crtcmd (3) = & H02 Crtcmd (4) = & H33 Crtcmd (5) = & H30 Crtcmd (6) = & H03 Crtcmd (7) = & H00 Printbin # 2, Crtcmd (1); 7 Wait 2 Crtcmd (1) = & H05 Printbin # 2, Crtcmd (1); 1 and I receive with REALTERM this: 02 00 02 333 030 03 00 05 WHY???

BASCOM-AVR : card reader : REPLY

$
0
0
answered the crosspost here: https://bascomforum.de/index.php?thread/1215-card-reader/&postID=19361#post19361

BASCOM-AVR : Fastest IC : REPLY

$
0
0
maybe I'm a liitle bit too old but I remember to have used the HCF4520B a IC which count the pulse , you can cascade them to have a bigger counter It counted around 5/6mhz pulses not so bad ! like that your µP is only a reader of the IC :wink: JP

BASCOM-AVR : card reader : REPLY

BASCOM-AVR : card reader : REPLY

$
0
0
with this code in VB.net and connecting to the PC's RS232 it works!

BASCOM-AVR : card reader : REPLY

$
0
0
with this code in VB.net and connecting to the PC's RS232 it works! I put a rs232 driver in the middle, I checked the rx and tx pins ... nothing works only if I connect it with the PC! the strange thing, and that if I connect the microprocessor to the PC I correctly receive the hexadecimal string with REALTERM! why??? this is the Bascom code I use:

BASCOM-AVR : card reader : REPLY

$
0
0
with this code in VB.net and connecting to the PC's RS232 it works! I put a rs232 driver in the middle, I checked the rx and tx pins ... nothing works only if I connect it with the PC! the strange thing, and that if I connect the microprocessor to the PC I correctly receive the hexadecimal string with REALTERM! why??? this is the Bascom code I use: [code:1:5faaaeb345]Print #2 , Chr(&H2) ; Chr(&H0) ; Chr(&H2) ; Chr(&H33) ; Chr(&H30) ; Chr(&H3) ; Chr(&H0); Wait 2 Print #2 , Chr(&H5) ;[/code:1:5faaaeb345]

BASCOM-AVR : card reader : REPLY

$
0
0
then we reset everything. Point 1. con questo comando POWERON in vb.net SerialPort1.Write(Chr(&H2) + Chr(&H0) + Chr(&H2) + Chr(&H33) + Chr(&H30) + Chr(&H3) + Chr(&H0) + Chr(&H5)) and with the card reader, connected directly to the PC via the serial port, it works! Point 2. By connecting the reader via an RS232 driver to the ATMEGA1284 and the following code in BASCOM: Print Chr(&H2) ; Chr(&H0) ; Chr(&H2) ; Chr(&H33) ; Chr(&H30) ; Chr(&H3) ; Chr(&H0); Chr(&H5); DOES NOT WORK! Point 3. By connecting the microprocessor via the RS232 driver to the PC I receive this:

BASCOM-AVR : Fastest IC : REPLY

$
0
0
I used the interrupt function. In the interupt I read then by an if query from which direction the encoder turns that works very well. I'd like a bigger buffer by a faster IC. If I want to use the XMega series with 32MHz I need an external crystal or is the internal oscillator enough.

BASCOM-AVR : Fastest IC : REPLY

$
0
0
The mega1284 has 16K of ram and 20mhz speed with external crystal a large buffer is not a problem Try not to do too much in an interrupt below is how I decode the IR pulses [code:1:1cc7ef5c6b] 'this gets called when we receive IR pulses on interrupt two pin Int_2isr: ' Print "yes" ' Lcdat 1 , 1 , "IR>>>>" Pulsein Length , Pinb , 2 , 1 'here we measure the length of the pulse 'Note many start with a 450 pulse which 'you can use to indicate start BUT NOT ALL DO! Select Case Length Case 0 'end of data, 'Lcdat 1 , 1 , "BX=3" ' Wait 1 Bx = 3 Case Is < 80 'adjust for timing as seen in 'PROTOCOL_TEST_TIMING Datagot.px = 0 Case Is < 190 Datagot.px = 1 'Most of the time this is only there to get the receiver to start up 'and is not needed for decode of data Case Is < 500 'start of transmission Case Is > 3500 'end block some remotes transmit 'more than one block of data 'but we will not need this second 'block most of the time 'Incr Flag Px = 0 End Select Incr Px Return [/code:1:1cc7ef5c6b]

BASCOM-AVR : Fastest IC : REPLY

$
0
0
It all depends on what you are trying to achieve. If you only need to count the pulses, then instead of interrupts, use the hardware counters. You can add a front end logic to determine if this is forward or reverse pulse. You can also use the XMega that has a built in quadrature decoder that can generate event to the counters.

BASCOM-AVR : Read the data in hexadecimal : NEWTOPIC

$
0
0
Hi, I have to receive data in hexadecimal, from the serial port, ... what do you recommend? [b:e1dd13cf5d][color=red:e1dd13cf5d](BASCOM-AVR version : 2.0.8.1 )[/b:e1dd13cf5d][/color:e1dd13cf5d]

BASCOM-AVR : card reader : REPLY

$
0
0
it works! the connector supplied for the rs232 connection had inverted wires !!!

BASCOM-AVR : Read the data in hexadecimal : REPLY

$
0
0
[quote:66fc1daa3e]I have to receive data in hexadecimal, from the serial port, ... what do you recommend?[/quote:66fc1daa3e] you have a lot of tools to transform hexa to dec or to bin HEX, hexval for hexa try this small sample [code:1:66fc1daa3e]'-----HEX-----HEXVAL------------------------------------------------ dim nombrelong as word dim mot as string*10 Nombrelong = 43690 Mot = Hex(nombrelong) Nombrelong = Hexval(mot) Print "MOT hexa: " ; Mot ; " nombrelong: " ; Nombrelong[/code:1:66fc1daa3e] and some help about the variables tools sorry in french : ABS Renvoie la valeur absolue d'une variable signée ASC Renvoie le code ASCII d'un caractère ou de la première lettre d'un mot. Voir CHR BCD Transforme une variable au format BCD en String BIN Transforme une variable en représentation binaire (string) BINVAL Transforme une représentation binaire en variable CHR Renvoie le caractère équivalent au code ASCII. Voir ASC DECR Décrémente une variable de 1 FIX Renvoie une valeur approchée arrondie à 0 plus petite si supérieure à 0, plus grande si inférieure à 0 FRAC Renvoie la partie décimale d’un nombre, Y=FRAC(1.256), Y=0.256 HEX Transforme une variable décimale en représentation hexadécimale (string) HEXVAL Transforme une représentation Hexadécimale (string) en variable décimale HIGH Récupère le MSB d'une variable integer HIGHW Récupère le MSB d'une variable long INT Retourne la valeur entière d’une variable single int(3.8)=3 INCR Incrémente une variable de 1 LOW Récupère le LSB d'une variable integer MAKEBCD Transforme une variable décimale en valeur BCD MAKEDEC Transforme une variable BCD en variable décimale MAKEINT Compacte deux bytes en une Integer ou Long ROTATE Fait tourner dans le sens demandé, du nombre de bits demandé. ROUND Renvoie une valeur approchée arrondie à la plus proche valeur :2.3=2 2.8=3 SHIFT Fait avancer les bits dans le sens demandé et supprime les bits qui ne sont plus représentés dans l'octet. SWAP Echange deux variables de même type TOGGLE Fait varier l'état d'un bit. VAL Transforme une représentation (string) d'une variable en variable.

BASCOM-AVR : pn532 with bascom : NEWTOPIC

$
0
0
I did today reading rf-cards in pn532, here the link [url]https://www.elechouse.com/elechouse/index.php?main_page=product_info&cPath=90_93&products_id=2242[/url]. This device is connected with Arduino Uno by i2c protocoll. Perhaps the code isn't very beautiful but works (at least for me) ;) All needed telegrams (frames) I've found in youtube so I only copied them into my program. I would appreciate if someone will add a unit or code to create the checksum form telegrams. This program is written for i2c. Have a fun;) [code:1:f2376969e9] $regfile = "m328pdef.dat" $crystal = 16000000 $baud = 115200 ' use baud rate $hwstack = 80 ' default use 32 for the hardware stack $swstack = 80 ' default use 10 for the SW stack $framesize = 90 ' default use 40 for the frame space Dim M As Word Dim Zapyt(9) As Byte Dim ZapytID(11) As Byte 'inListPassiveTargets - read ID RF-cards Dim ZapytEx(12) As Byte Dim ZapytSAM(14) As Byte Dim ZapytStat(9) As Byte Dim ZapytRel(10) as Byte 'inRelease - The goal of this command is to release the target(s) Tg Dim Wake_up(4) As Byte Dim dane(21) As Byte Dim daneID(28) As Byte Dim dane_ack(6) As Byte Dim addr_w as byte Dim addr_r as byte Wake_up(1) = &H55 Wake_up(2) = &H55 Wake_up(3) = &H00 Wake_up(4) = &H00 Zapyt(1) = &H00 Zapyt(2) = &H00 Zapyt(3) = &HFF Zapyt(4) = &H02 Zapyt(5) = &HFE Zapyt(6) = &HD4 Zapyt(7) = &H02 Zapyt(8) = &H2A Zapyt(9) = &H00 ZapytRel(1) = &H00 ZapytRel(2) = &H00 ZapytRel(3) = &HFF ZapytRel(4) = &H03 ZapytRel(5) = &HFD ZapytRel(6) = &HD4 ZapytRel(7) = &H52 ZapytRel(8) = &H01 ZapytRel(9) = &HD9 ZapytRel(10) = &H00 ZapytID(1) = &H00 ZapytID(2) = &H00 ZapytID(3) = &HFF ZapytID(4) = &H04 ZapytID(5) = &HFC ZapytID(6) = &HD4 ZapytID(7) = &H4A ZapytID(8) = &H01 ZapytID(9) = &H00 ZapytID(10) = &HE1 ZapytID(11) = &H00 ZapytStat(1) = &H00 ZapytStat(2) = &H00 ZapytStat(3) = &HFF ZapytStat(4) = &H02 ZapytStat(5) = &HFE ZapytStat(6) = &HD4 ZapytStat(7) = &H04 ZapytStat(8) = &H28 ZapytStat(9) = &H00 ZapytEx(1) = &H00 ZapytEx(2) = &H00 ZapytEx(3) = &HFF ZapytEx(4) = &H05 ZapytEx(5) = &HFB ZapytEx(6) = &HD4 ZapytEx(7) = &H40 ZapytEx(8) = &H01 ZapytEx(9) = &H30 ZapytEx(10) = &H00 ZapytEx(11) = &HBB ZapytEx(12) = &H00 ZapytSAM(1) = &H55 ZapytSAM(2) = &H55 ZapytSAM(3) = &H00 ZapytSAM(4) = &H00 ZapytSAM(5) = &H00 ZapytSAM(6) = &H00 ZapytSAM(7) = &HFF ZapytSAM(8) = &H03 ZapytSAM(9) = &HFD ZapytSAM(10) = &HD4 ZapytSAM(11) = &H14 ZapytSAM(12) = &H01 ZapytSAM(13) = &H17 ZapytSAM(14) = &H00 'I2C Config I2cdelay = 10 Config Twi = 100000 Config Scl = Portc.5 Config Sda = Portc.4 $lib "I2C_TWI.LBX" addr_w=&H48 addr_r=&H49 I2cinit print "Reading RF cards. Put over PN532 a card.." print 'SAM + WAKEUP! I2cstart I2cwbyte addr_w for m=1 to 14 I2cwbyte zapytSAM(m) next m I2cstop waitms 500 'ACK I2cstart I2cwbyte addr_r for m=1 to 5 I2crbyte Dane_ack(m) , Ack next I2crbyte Dane_ack(6) , NAck I2cstop ' Print "ACK "; Hex(dane_ack(1));".";Hex(dane_ack(2));".";Hex(dane_ack(3));".";Hex(dane_ack(4));".";Hex(dane_ack(5));".";Hex(dane_ack(6)) I2cstart I2cwbyte addr_r for m=1 to 8 I2crbyte Dane(m) , Ack next I2crbyte Dane(9) , NAck I2cstop waitms 100 '-------------------------------------------------------------------------- Do I2cstart I2cwbyte addr_w for m=1 to 11 I2cwbyte zapytID(m) next m I2cstop waitms 50 I2cstart I2cwbyte addr_r for m=1 to 27 I2crbyte DaneID(m) , Ack next I2crbyte DaneID(28) , NAck I2cstop 'byte nr 12 changes when the rf-card is put over pn532 'so I check the state of this byte if hex(daneID(12))<>"00" then I2cstart I2cwbyte addr_w for m=1 to 10 I2cwbyte zapytRel(m) next m I2cstop Print "FOUND : " ;Hex(daneID(14));".";Hex(daneID(15));".";Hex(daneID(16));".";Hex(daneID(17));".";Hex(daneID(18));".";Hex(daneID(19));".";Hex(daneID(20)) end if waitms 600 loop End [/code:1:f2376969e9] [b:f2376969e9][color=red:f2376969e9](BASCOM-AVR version : 2.0.8.0 , Latest : 2.0.8.1 )[/b:f2376969e9][/color:f2376969e9]

BASCOM-AVR : pn532 with bascom : REPLY

$
0
0
Bascom already has 6 types of CRC built in what is needed? Regards Paul

BASCOM-AVR : pn532 with bascom : REPLY

$
0
0
Hi, It shames me to say, but I do not want to think about it. The point is (from a pn532 manual): [quote:e6710aa03a] - LEN 1 byte indicating the number of bytes in the data field (TFI and PD0 to PDn), - LCS 1 Packet Length Checksum LCS byte that satisfies the relation: Lower byte of [LEN + LCS] = 0x00, - TFI 1 byte frame identifier, the value of this byte depends on the way of the message: -- D4h in case of a frame from the host controller to the PN532, -- D5h in case of a frame from the PN532 to the host controller. - DATA LEN-1 bytes of Packet Data Information The first byte PD0 is the Command Code, - DCS 1 Data Checksum DCS byte that satisfies the relation: Lower byte of [TFI + PD0 + PD1 + … + PDn + DCS] = 0x00, [/quote:e6710aa03a] Regards, Martin
Viewing all 20606 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>