Цитата |
---|
NiGMa пишет:
необходимо согласовать параметры порта на локальном компьютере (у этой ККМ скорость порта нестандартная - 10416). |
Один из способов получить такую нестандартную скорость, это использовать USB to COM конвертер например на чипе FT232R. Заодно решится извечная проблема нехватки портов, а если уж совсем постараться, то и гальваническую развязку с компом организовать.
Вот выдержка из документации на этот чип:
Setting Baud Rates for FT232R, FT2232C and FT232BM Devices
© Future Technology Devices International Ltd. 2006
1.3 Baud Rate Calculation
A Baud rate for the FT232R, FT2232C (UART mode) or FT232BM is generated using the chips
internal 48MHz clock. This is input to Baud rate generator circuitry where it is then divided by 16
and fed into a prescaler as a 3MHz reference clock. This 3MHz reference clock is then divided
down to provide the required Baud rate for the device's on chip UART. The value of the Baud rate
divisor is an integer plus a sub-integer prescaler. The original FT8U232AM only allowed 3 subinteger
prescalers - 0.125, 0.25 or 0.5. The FT232R, FT2232C (UART mode) and FT232BM
support a further 4 additional sub-integer prescalers - 0.375, 0.625, 0.75, and 0.875. Thus, allowed
values for the Baud rate divisor are:
Divisor = n + 0, 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875; where n is an integer between 2 and
16384 (214).
Note: Divisor = 1 and Divisor = 0 are special cases. A divisor of 0 will give 3 MBaud, and a divisor
of 1 will give 2 MBaud. Sub-integer divisors between 0 and 2 are not allowed.
Therefore the value of the divisor needed for a given Baud rate is found by dividing 3000000 by the
required Baud rate.
The exact Baud rate may not be achievable - however as long as the actual Baud rate used is
within +/-3% of the required Baud rate then the link should function without errors. When a Baud
rate is passed to the driver where the exact divisor required is not achievable the closest possible
Baud rate divisor will be used as long as that divisor gives a Baud rate which is within +/- 3% of the
Baud rate originally set.
For example:
A non-standard Baud rate of 490000 Baud is required.
Required divisor = 3000000 / 490000 = 6.122
The closest achievable divisor is 6.125, which gives a baud rate of 489795.9, which is well within
the allowed +/- 3% margin of error. Therefore 490000 can be passed to the driver and the device
will communicate without errors.
© Future Technology Devices International Ltd. 2006