JP3069867U - Electronic equipment - Google Patents

Electronic equipment

Info

Publication number
JP3069867U
JP3069867U JP1999009710U JP971099U JP3069867U JP 3069867 U JP3069867 U JP 3069867U JP 1999009710 U JP1999009710 U JP 1999009710U JP 971099 U JP971099 U JP 971099U JP 3069867 U JP3069867 U JP 3069867U
Authority
JP
Japan
Prior art keywords
data
transfer
bytes
buffer
byte
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Lifetime
Application number
JP1999009710U
Other languages
Japanese (ja)
Inventor
貴志 平野
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Funai Electric Co Ltd
Original Assignee
Funai Electric Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Funai Electric Co Ltd filed Critical Funai Electric Co Ltd
Priority to JP1999009710U priority Critical patent/JP3069867U/en
Application granted granted Critical
Publication of JP3069867U publication Critical patent/JP3069867U/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Landscapes

  • Information Transfer Systems (AREA)

Abstract

(57)【要約】 【課題】バッファにデータを転送するための手順を簡単
化する。 【解決手段】データ量が2nバイト(nは自然数)以下
の範囲で変化する転送用データを一時記憶し、データエ
リアが2nバイトに固定されたバッファ11と、転送用
データのバイト数が書き込まれるバイトカウンタ12
と、所定エリアに格納された転送用データをバッファ1
1に転送すると共に、転送時のデータ幅が2の累乗バイ
トである転送手段3とを備えており、転送手段3は、転
送用データをバッファ11に転送するときには、転送用
データのバイト数が2nバイトより少なくなるときに
も、転送用データを含む2nバイトのデータをバッファ
11に転送し、バイトカウンタ12には転送用データの
バイト数を書き込む。
(57) [Summary] To simplify a procedure for transferring data to a buffer. Kind Code: A1 A buffer for temporarily transferring transfer data whose data amount changes within a range of 2n bytes (n is a natural number) or less, and a buffer having a fixed data area of 2n bytes and the number of bytes of the transfer data are written. Byte counter 12
And the transfer data stored in the predetermined area
1 and a transfer unit 3 whose data width at the time of transfer is a power of 2 bytes. When the transfer unit 3 transfers the transfer data to the buffer 11, the number of bytes of the transfer data is When the number of bytes becomes smaller than 2n bytes, 2n-byte data including the transfer data is transferred to the buffer 11, and the byte counter 12 is written with the number of bytes of the transfer data.

Description

【考案の詳細な説明】[Detailed description of the invention]

【0001】[0001]

【考案の属する技術分野】[Technical field to which the invention belongs]

本考案は、例えば16バイト等のように、データエリアのバイト数が固定され たバッファに、バイト数が変化する転送用データを転送する電子装置に係り、よ り詳細には、転送用データのバイト数がバッファのバイト数より少ないときにも 、転送用データを含んで、バッファのバイト数に等しいバイト数のデータを転送 する電子装置に関するものである。 The present invention relates to an electronic device for transferring transfer data having a variable number of bytes to a buffer having a fixed number of bytes in a data area, such as 16 bytes. The present invention relates to an electronic device for transferring data having a number of bytes equal to the number of bytes of a buffer, including transfer data, even when the number of bytes is smaller than the number of bytes of a buffer.

【0002】[0002]

【従来の技術】[Prior art]

USB(Universal Serial Bus)を介してホストコンピ ュータに接続されるプリンタでは、16バイト以下のデータをホストコンピュー タに送信する機能が要求される。このため、プリンタ内には、ホストコンピュー タに送信するためのデータを一時的に記憶する16バイトのバッファが設けられ ている。また、バッファに転送されたデータのバイト数を記憶するためのバイト カウンタが設けられている。このため、CPUは、バッファに転送するためのデ ータを、CPU内部のレジスタに格納した後、このレジスタ内のデータをバッフ ァに転送する。そして後、バッファに転送したデータのバイト数を示す数値をバ イトカウンタに書き込んでいる(第1の従来技術とする)。 A printer connected to a host computer via a USB (Universal Serial Bus) requires a function of transmitting data of 16 bytes or less to the host computer. Therefore, a 16-byte buffer for temporarily storing data to be transmitted to the host computer is provided in the printer. Further, a byte counter is provided for storing the number of bytes of data transferred to the buffer. Therefore, the CPU stores the data to be transferred to the buffer in a register inside the CPU, and then transfers the data in this register to the buffer. After that, a numerical value indicating the number of bytes of the data transferred to the buffer is written in a byte counter (referred to as a first conventional technique).

【0003】 また、USBのデータ転送における従来技術の1つに、特開平11−8838 1号として提案された技術がある。すなわち、この技術では、受信したトークン パケットから、データの受信であるのか、あるいはデータの送信であるのかを検 出している。そして、データの受信であるときには、表示器によって受信である ことを表示し、データの送信であるときには、表示器によって送信であることを 表示している(第2の従来技術とする)。[0003] One of the conventional techniques for USB data transfer is a technique proposed as Japanese Patent Application Laid-Open No. 11-88381. That is, in this technique, it is detected from the received token packet whether the data is received or transmitted. When the data is received, the display indicates that the data is received, and when the data is transmitted, the display indicates that the data is transmitted (this is referred to as a second conventional technique).

【0004】 また、特開平10−326251号として提案された従来技術がある。すなわ ち、この技術では、周辺装置の内部に設けられた2つのマスタによってアクセス することが可能なパケットバッファを持ったデータ経路を有する構成としている 。このため、従来に比したときには、メモリを、より効率的に使用することがで きるようになっている(第3の従来技術とする)。Further, there is a conventional technique proposed as Japanese Patent Application Laid-Open No. 10-326251. In other words, this technique has a configuration having a data path having a packet buffer that can be accessed by two masters provided inside the peripheral device. For this reason, the memory can be used more efficiently as compared with the related art (third related art).

【0005】[0005]

【考案が解決しようとする課題】[Problems to be solved by the invention]

しかしながら、第1の従来技術において、CPUを主要部とする転送手段に、 データ転送時のデータ幅が2バイトまたは4バイトである構成を用いる場合では 、以下に示す問題が生じていた。このことを、図5を参照しつつ説明する。 However, in the first prior art, when the configuration in which the data width at the time of data transfer is 2 bytes or 4 bytes is used as the transfer means mainly including the CPU, the following problem occurs. This will be described with reference to FIG.

【0006】 いま、16バイトのエリアを有するバッファに転送するデータが、7バイトで あるとする。まず、CPUは、転送すべきデータのバイト数を調べ(ステップS 11)、4バイト以上であるときには、4バイトのデータ転送を行う(ステップ S12)。次に、ステップS13からステップS11に戻り、残りのデータが4 バイトより少ないことを調べた後、さらに、残りのデータが2バイト以上である かどうかを調べる(ステップS14)。このときには、2バイト以上のデータが 残っているため、2バイトのデータ転送を行う(ステップS15)。そして後に は、動作がステップS13,S11,S14からステップS16に進み、1バイ トのデータ転送を行うことになる。Now, it is assumed that data to be transferred to a buffer having an area of 16 bytes is 7 bytes. First, the CPU checks the number of bytes of data to be transferred (step S11), and if it is 4 bytes or more, transfers 4 bytes of data (step S12). Next, the process returns from step S13 to step S11, and after checking that the remaining data is less than 4 bytes, further checks whether or not the remaining data is 2 bytes or more (step S14). At this time, since two or more bytes of data remain, two-byte data transfer is performed (step S15). Thereafter, the operation proceeds from steps S13, S11, S14 to step S16, and one-byte data transfer is performed.

【0007】 以上のように、データをバッファに転送するときには、転送を行う前に、転送 すべきデータのバイト数を調べる必要がある。また、転送すべきデータのバイト 数に対応して、処理を分岐させる必要がある。このため、データ転送を記述する プログラムの手順の複雑化を招いている。また、ステップS16における1バイ トのデータ転送では、以下に述べる問題も併せて生じる。As described above, when transferring data to a buffer, it is necessary to check the number of bytes of data to be transferred before performing the transfer. In addition, it is necessary to branch processing according to the number of bytes of data to be transferred. This complicates the procedure of the program that describes the data transfer. Further, in the one-byte data transfer in step S16, the following problem also occurs.

【0008】 すなわち、CPUを主要部とする転送手段の構成は、最少となるデータの転送 幅が2バイトの構成となっている。また、CPU内部のレジスタの2バイトのデ ータは、上位側の1バイトのデータが、メモリアドレスAに転送されるとすると 、下位側の1バイトのデータは、メモリアドレス(A+1)に転送される。一方 、1バイトのデータのみを内部レジスタに格納した場合、このデータは、レジス タ内で下位側の1バイトのデータとして記憶される。このため、ステップS16 における1バイトのデータ転送を行うときには、レジスタ内の下位側の1バイト のデータを、レジスタ内の上位側の1バイトのエリアに移動させた後、レジスタ のデータをバッファに転送する必要がある。このため、データ転送の手順が、さ らに複雑化するという問題が生じていた。That is, the configuration of the transfer means having the CPU as a main part is such that the minimum data transfer width is 2 bytes. Also, assuming that the upper one byte data is transferred to the memory address A, the lower one byte data is transferred to the memory address (A + 1). Is done. On the other hand, when only 1-byte data is stored in the internal register, this data is stored as lower-order 1-byte data in the register. Therefore, when performing 1-byte data transfer in step S16, the lower-order 1-byte data in the register is moved to the upper-order 1-byte area in the register, and then the register data is transferred to the buffer. There is a need to. For this reason, there has been a problem that the data transfer procedure is further complicated.

【0009】 また、第2の従来技術や第3の従来技術は、上記したデータ転送の手順の複雑 化を回避するという観点から見る場合では、適用することが困難な技術となって いる。The second and third prior arts are difficult to apply from the viewpoint of avoiding the above-described complicated data transfer procedure.

【0010】 本考案は上記課題を解決するため創案されたものであって、その目的は、2n バイトのデータエリアを有するバッファに、データの転送幅が2の累乗バイトで ある転送手段を用いて転送用データを書き込むときには、転送用データのバイト 数が2nバイトより少なくなるときにも、転送用データを含んだ2nバイトのデ ータをバッファに転送することにより、バッファにデータを転送するためのプロ グラムの手順を簡単化することのできる電子装置を提供することにある。The present invention has been made in order to solve the above-mentioned problem, and an object of the present invention is to provide a buffer having a data area of 2n bytes by using a transfer means whose data transfer width is a power of 2 bytes. When writing transfer data, even if the number of bytes of the transfer data is less than 2n bytes, transfer the data to the buffer by transferring 2n bytes of data including the transfer data to the buffer. Another object of the present invention is to provide an electronic device that can simplify the procedure of the program.

【0011】 また、上記目的に加え、バッファのデータエリアを4バイトの整数倍とし、転 送手段の構成を、4バイトのデータを一度に書き込む命令の実行機能を備えた構 成とすることにより、バッファへのデータ転送に要する時間を短縮することので きる電子装置を提供することにある。In addition to the above object, the data area of the buffer is set to an integral multiple of 4 bytes, and the transfer means is configured to have a function of executing an instruction to write 4-byte data at a time. Another object of the present invention is to provide an electronic device that can reduce the time required for data transfer to a buffer.

【0012】 また、上記目的に加え、4バイトのデータをワードとして、複数ワードのデー タ転送を指示するブロック転送命令の実行機能を有する転送手段を用いることに より、アセンブラレベルにおいて、データの転送手順を示す命令の命令数を低減 することのできる電子装置を提供することにある。In addition to the above object, by using a transfer means having a function of executing a block transfer instruction for instructing data transfer of a plurality of words using 4-byte data as a word, data transfer at an assembler level is achieved. An object of the present invention is to provide an electronic device capable of reducing the number of instructions indicating a procedure.

【0013】 また、上記目的に加え、USBを介してホストコンピュータに接続された構成 とすることにより、USBを介して接続されたホストコンピュータに送信するデ ータを準備するときの手順を簡単化することのできる電子装置を提供することに ある。[0013] In addition to the above-mentioned object, by connecting to a host computer via USB, the procedure for preparing data to be transmitted to the host computer connected via USB can be simplified. It is to provide an electronic device that can perform the operation.

【0014】 また、上記目的に加え、ホストコンピュータにデータを送信するときの手順を 簡単化することのできるプリンタを提供することにある。Another object of the present invention is to provide a printer capable of simplifying a procedure for transmitting data to a host computer, in addition to the above object.

【0015】[0015]

【課題を解決するための手段】[Means for Solving the Problems]

上記課題を解決するため本考案に係る電子装置は、nを自然数とするとき、デ ータ量が2nバイト以下の範囲で変化する転送用データを一時記憶すると共に、 そのデータエリアが2nバイトに固定されたバッファと、転送用データのバイト 数が書き込まれるバイトカウンタと、所定エリアに格納された転送用データを前 記バッファに転送すると共に、前記バッファに転送用データを転送するときのデ ータ幅が2の累乗バイト(例えば、2バイト、あるいは2バイトおよび4バイト 、等)である転送手段とを備えた電子装置に適用し、前記転送手段は、転送用デ ータを前記バッファに転送するときには、転送用データのバイト数が2nバイト より少なくなるときにも、転送用データを含む2nバイトのデータを前記バッフ ァに転送すると共に、バイトカウンタには転送用データのバイト数を書き込む構 成としている。 In order to solve the above-mentioned problem, the electronic device according to the present invention, when n is a natural number, temporarily stores transfer data whose data amount changes within a range of 2n bytes or less, and has a data area of 2n bytes. A fixed buffer, a byte counter in which the number of bytes of transfer data is written, and transfer data stored in a predetermined area to the buffer, and data for transferring the transfer data to the buffer. A transfer means having a data width of a power of 2 (for example, 2 bytes, or 2 bytes and 4 bytes, etc.), wherein the transfer means stores transfer data in the buffer. When transferring, even when the number of bytes of the transfer data is smaller than 2n bytes, when transferring 2n bytes of data including the transfer data to the buffer, To, have a configuration writes the number of bytes in the transfer data to the byte counter.

【0016】 すなわち、転送手段は、転送用データのバイト数に関わりなく、バッファには 、常に2nバイトのデータを転送する。そして、転送手段がバッファに2nバイ トのデータを転送する場合では、1バイトのデータを転送する事態が発生しない 。つまり、転送用データのバイト数がどのような値となるときにも、手順が複雑 となる1バイトのデータの転送が発生しない。また、バッファに書き込まれた2 nバイトのデータのうち、バイトカウンタに書き込まれた値によって示される範 囲のデータが転送用データであるため、転送用データと、転送用データではない データとは、互いに区別されることになる。That is, the transfer means always transfers 2n bytes of data to the buffer regardless of the number of bytes of transfer data. Then, when the transfer means transfers 2n-byte data to the buffer, the situation of transferring 1-byte data does not occur. In other words, no matter what value the number of bytes of the transfer data takes, the transfer of 1-byte data that complicates the procedure does not occur. Also, of the 2n-byte data written to the buffer, the data in the range indicated by the value written to the byte counter is the transfer data, so the transfer data and the non-transfer data are different. , Will be distinguished from each other.

【0017】 また、上記構成に加え、前記バッファのデータエリアを4バイトの整数倍とし 、前記転送手段は、4バイトのデータを一度に書き込む書込命令の実行機能を備 えた構成としている。In addition, in addition to the above configuration, the data area of the buffer is an integral multiple of 4 bytes, and the transfer means has a function of executing a write command for writing 4-byte data at a time.

【0018】 すなわち、バッファのデータエリアのバイト数の1/4の値をYとすると、転 送手段が、バッファにY回の書き込みを行うのみで、バッファへの転送用データ の書き込みが終了する。That is, assuming that the value of 1/4 of the number of bytes in the data area of the buffer is Y, the transfer means only writes the buffer Y times, and the writing of the transfer data to the buffer is completed. .

【0019】 また、上記構成に加え、4バイトのデータをワードとするとき、前記転送手段 は、複数ワードのデータ転送を1命令で指示するブロック転送命令の実行機能を 備えた構成としている。Further, in addition to the above configuration, when 4-byte data is converted into a word, the transfer unit has a function of executing a block transfer instruction for instructing data transfer of a plurality of words by one instruction.

【0020】 すなわち、アセンブラレベルの1つの命令によって、バッファに転送用データ を転送する動作を記述することができる。That is, the operation of transferring the transfer data to the buffer can be described by one assembler-level instruction.

【0021】 また、上記構成に加え、前記バッファに転送された転送用データを、USBを 介してホストコンピュータに送信する通信制御部を備えた構成としている。Further, in addition to the above configuration, a communication control unit that transmits the transfer data transferred to the buffer to a host computer via a USB is provided.

【0022】 すなわち、USBを介して接続されたホストコンピュータに送信するデータを バッファに準備するときの手順が簡単化される。That is, the procedure for preparing data to be transmitted to the host computer connected via the USB in the buffer is simplified.

【0023】 また、上記構成に加え、前記USBを介してホストコンピュータから受信した 印字データを印字するプリンタとしている。Further, in addition to the above configuration, the printer is configured to print out print data received from the host computer via the USB.

【0024】 すなわち、USBを介して接続されたホストコンピュータからの印字データを 印字するプリンタにおいては、ホストコンピュータに送信するデータをバッファ に準備するときの手順が簡単化される。That is, in a printer that prints print data from a host computer connected via USB, the procedure for preparing data to be transmitted to the host computer in a buffer is simplified.

【0025】[0025]

【考案の実施の形態】 以下に本考案の実施例の形態を、図面を参照しつつ説明する。 図1は、本考案に係る電子装置の一実施形態の電気的構成を示すブロック線図 であり、詳細には、USBを介した通信機能を有するプリンタを示している。DESCRIPTION OF THE PREFERRED EMBODIMENTS Embodiments of the present invention will be described below with reference to the drawings. FIG. 1 is a block diagram showing an electrical configuration of an embodiment of the electronic device according to the present invention, and specifically shows a printer having a communication function via USB.

【0026】 プリンタ1は、USBケーブル17を介して接続されたホストコンピュータ2 から送信される印字データを印字する装置となっている。また、ホストコンピュ ータ2がデータの送信を要求するときには、要求されたデータの送信を行う。ま た、このときに送信するデータは、16バイト以下の範囲で、バイト数が変化す るデータとなっている。このため、プリンタ1は、大別したときには、CPU4 、メモリコントローラ5、主メモリ6、印字部7、および通信部15を備えてい る。The printer 1 is a device that prints print data transmitted from the host computer 2 connected via a USB cable 17. When the host computer 2 requests data transmission, the host computer 2 transmits the requested data. The data transmitted at this time is data whose number of bytes changes within a range of 16 bytes or less. For this reason, when roughly classified, the printer 1 includes a CPU 4, a memory controller 5, a main memory 6, a printing unit 7, and a communication unit 15.

【0027】 通信部15は、ホストコンピュータ2と通信を行うときのイタフェースとなる ブロックとなっている。すなわち、ホストコンピュータ2が要求するデータを、 ホストコンピュータ2が要求するタイミングで送信する。また、ホストコンピュ ータ2が送信する印字データの受信を行う。このため、バッファ11、バイトカ ウンタ12、トリガ13、および、通信制御部14を備えている。The communication section 15 is a block serving as an interface when communicating with the host computer 2. That is, the data requested by the host computer 2 is transmitted at the timing requested by the host computer 2. Further, it receives print data transmitted by the host computer 2. For this purpose, a buffer 11, a byte counter 12, a trigger 13, and a communication control unit 14 are provided.

【0028】 バッファ11は、nを自然数とするとき、2nバイトのデータエリアを有する メモリであり、本実施形態では、16バイトのデータエリアを有するメモリとな っている。そして、ホストコンピュータ2に送信すべきデータ(16バイト以下 の範囲でバイト数が変化するデータであり、以下では転送用データと称する)を 記憶する。また、バイトカウンタ12は、バッファ11に記憶された転送用デー タのバイト数を記憶するレジスタとなっている。The buffer 11 is a memory having a data area of 2n bytes, where n is a natural number. In the present embodiment, the buffer 11 is a memory having a data area of 16 bytes. Then, data to be transmitted to the host computer 2 (data whose number of bytes changes within a range of 16 bytes or less, hereinafter, referred to as transfer data) is stored. The byte counter 12 is a register that stores the number of bytes of transfer data stored in the buffer 11.

【0029】 また、トリガ13は、1ビットのフラグとなっており、セットされたときには 、バッファ11には転送用データが記憶され、バイトカウンタ12には、転送用 データのバイト数が記憶されていることを通信制御部14に知らせる。また、リ セットされたときには、転送用データの準備ができていないことを通信制御部1 4に知らせる。The trigger 13 is a 1-bit flag. When the trigger 13 is set, the buffer 11 stores transfer data, and the byte counter 12 stores the number of bytes of the transfer data. To the communication control unit 14. When reset, it notifies the communication controller 14 that the transfer data is not ready.

【0030】 通信制御部14は、トリガ13がセットされているとき、ホストコンピュータ 2から送信要求があると、バッファ11に記憶され、バイトカウンタ12により バイト数が示される転送用データを、USBケーブル17を介して、ホストコン ピュータ2に送信する。一方、トリガ13がリセットされているとき、ホストコ ンピュータ2から送信要求があると、データを送信できないことをホストコンピ ュータ2に知らせる。また、ホストコンピュータ2から送信された印字データを 受信し、所定エリアに記憶する。When the trigger 13 is set and a transmission request is received from the host computer 2, the communication control unit 14 transfers the transfer data stored in the buffer 11 and indicating the number of bytes indicated by the byte counter 12 to the USB cable. 17 to the host computer 2. On the other hand, when the trigger 13 is reset, if there is a transmission request from the host computer 2, it notifies the host computer 2 that data cannot be transmitted. Further, it receives the print data transmitted from the host computer 2 and stores it in a predetermined area.

【0031】 CPU4は、プリンタ1としての主要動作を制御するためのブロックとなって おり、32ビットのデータバス幅を有する素子となっている。また、内部には、 それぞれが32ビットの5本のレジスタR0〜R4(20〜24)を備えている (その他のレジスタについては、図示を省略)。メモリコントローラ5は、CP U4のバス8の電気的特性およびタイミングと、内部バス9の電気的特性および タイミングとの整合を行うためのブロックとなっている。The CPU 4 is a block for controlling main operations of the printer 1 and is an element having a data bus width of 32 bits. Further, five registers R0 to R4 (20 to 24) each having 32 bits are provided therein (other registers are not shown). The memory controller 5 is a block for matching the electrical characteristics and timing of the bus 8 of the CPU 4 with the electrical characteristics and timing of the internal bus 9.

【0032】 請求項に記載した転送手段は、CPU4とメモリコントローラ5とからなるブ ロック3により構成されている。そして、このような構成となるときのCPU4 について説明する。The transfer means described in the claims comprises a block 3 comprising a CPU 4 and a memory controller 5. The CPU 4 having such a configuration will be described.

【0033】 CPU4は、転送用データをバッファ11に転送するときには、転送用データ のバイト数が16バイトより少なくなるときにも、転送用データを含む16バイ トのデータをバッファ11に転送する。また、バイトカウンタ12には、転送用 データのバイト数を書き込む。なお、CPU4は、転送用データを含む16バイ トのデータをバッファ11に転送するときには、16バイトのデータを、4バイ トづつ、4回に分けて転送する。When transferring the transfer data to the buffer 11, the CPU 4 transfers 16 bytes of data including the transfer data to the buffer 11 even when the number of bytes of the transfer data becomes smaller than 16 bytes. The byte counter 12 writes the number of bytes of the transfer data. When transferring 16-byte data including the transfer data to the buffer 11, the CPU 4 transfers the 16-byte data in four times, four bytes at a time.

【0034】 上記したCPU4について、アセンブラレベルにおける機能を説明すると、C PU4は、2の累乗バイトのデータを一度に書き込む命令の実行機能を備えてい る。すなわち、CPU4は、2バイトのデータを一度に転送する命令の実行機能 を備えている。また、4バイトのデータを一度に転送する命令の実行機能を備え ている。また、4バイトのデータをワードとするとき、複数ワードのデータ転送 を1命令で指示するブロック転送命令の実行機能を備えている。The function of the CPU 4 at the assembler level will be described. The CPU 4 has a function of executing an instruction to write data of a power of 2 at a time. That is, the CPU 4 has a function of executing an instruction to transfer 2-byte data at a time. Also, it has a function to execute an instruction to transfer 4-byte data at a time. In addition, when 4-byte data is converted into a word, a function of executing a block transfer instruction for instructing data transfer of a plurality of words by one instruction is provided.

【0035】 主メモリ6は、ROMやRAMによって構成されたブロックとなっており、C PU4により実行されるプログラムが格納されている。また、CPU4のための ワークエリアを提供する。印字部7は、印字ヘッド、印字ヘッドの駆動機構、印 字用紙の駆動機構、等を備えたブロックとなっており、ホストコンピュータ2か ら送信された印字データを印字用紙に印字する。The main memory 6 is a block composed of a ROM and a RAM, and stores a program executed by the CPU 4. It also provides a work area for the CPU 4. The printing unit 7 is a block including a print head, a print head drive mechanism, a print paper drive mechanism, and the like, and prints print data transmitted from the host computer 2 on print paper.

【0036】 図2は、転送用データをホストコンピュータ2に送信するときの主要動作を示 すフローチャート、図3は、転送用データをバッファ11に転送する動作を、ア センブラレベルで示すフローチャート、図4は、レジスタR0〜R3(20〜2 3)の状態を示す説明図である。必要に応じてこれらの図を参照しつつ、実施形 態の動作を説明する。FIG. 2 is a flowchart showing a main operation when transmitting transfer data to the host computer 2. FIG. 3 is a flowchart showing an operation of transferring the transfer data to the buffer 11 at an assembler level. 4 is an explanatory diagram showing the states of the registers R0 to R3 (20 to 23). The operation of the embodiment will be described with reference to these drawings as necessary.

【0037】 CPU4においては、レジスタR0〜R3(20〜23)が、転送用データを 記憶するために使用される。また、レジスタR4(24)は、転送用データの転 送先アドレス(バッファ11の先頭アドレス)を示すために使用される。In the CPU 4, registers R0 to R3 (20 to 23) are used for storing transfer data. The register R4 (24) is used to indicate the transfer destination address of the transfer data (the head address of the buffer 11).

【0038】 いま、転送用データが11バイトであるとする。このときでは、予め、転送用 データがレジスタR0〜R3(20〜23)に準備される。図4を参照しつつ、 詳細に説明すると、転送用データの先頭バイトのデータは、レジスタR0(20 )の上位側の1バイトのエリア201に記憶され、転送用データの次に続くバイ トのデータは、エリア202に記憶される。以下、同様に、次に続くバイトのデ ータは、エリア203、204と記憶される。Now, it is assumed that the transfer data is 11 bytes. At this time, transfer data is prepared in the registers R0 to R3 (20 to 23) in advance. More specifically, referring to FIG. 4, the data of the first byte of the transfer data is stored in the upper byte area 201 of the register R0 (20), and the next byte of the data following the transfer data is stored. Data is stored in area 202. Hereinafter, similarly, the data of the next succeeding byte is stored as areas 203 and 204.

【0039】 そして、転送用データのさらに続くバイトのデータは、レジスタR1(21) のエリア211〜214と、レジスタR2(22)のエリア221〜223とに 記憶される。そして、レジスタR2(22)のエリア224と、レジスタR3( 23)のエリア231〜234とからなる5バイトのエリアは無視され、そのデ ータは不定の状態に置かれる。Then, the data of the byte following the transfer data is stored in the areas 211 to 214 of the register R1 (21) and the areas 221 to 223 of the register R2 (22). The 5-byte area consisting of the area 224 of the register R2 (22) and the areas 231 to 234 of the register R3 (23) is ignored, and the data is placed in an undefined state.

【0040】 転送用データをバッファ11に転送する直前の状態では、転送用データは、上 記したように記憶される。この状態において、CPU4は、レジスタR0〜R3 (20〜23)内の4ワードのデータ(11バイトの転送用データを含む16バ イトのデータ)を、バッファ11にブロック転送する。従って、レジスタR0( 20)のエリア201から、レジスタR2(22)のエリア223までに記憶さ れた11バイトの転送用データは、バッファ11のアドレスの先頭から11バイ ト目までのエリアに転送される(ステップS1)。In a state immediately before the transfer data is transferred to the buffer 11, the transfer data is stored as described above. In this state, the CPU 4 performs block transfer of the 4-word data (16-byte data including 11-byte transfer data) in the registers R0 to R3 (20 to 23) to the buffer 11. Therefore, the 11-byte transfer data stored from the area 201 of the register R0 (20) to the area 223 of the register R2 (22) is transferred to the area from the head of the address of the buffer 11 to the 11th byte. Is performed (step S1).

【0041】 転送用データをバッファ11に転送した後には、CPU4は、バイトカウンタ 12に、転送用データのバイト数を示す値11を書き込む(ステップS2)。そ して後、トリガ13をセットする(ステップS3)。トリガ13がセットされた 状態において、ホストコンピュータ2から送信要求があった場合、通信制御部1 4は、バイトカウンタ12により示されるバイト数の転送用データ(11バイト の転送用データ)を、バッファ11の先頭アドレスから、順次、読み出す。そし て、読み出した転送用データをホストコンピュータ2に送信する(ステップS4 ,S5)。その結果、レジスタR0(20)のエリア201から、レジスタR2 (22)のエリア223までに記憶されていた11バイトの転送用データがホス トコンピュータ2に送信されることになる。After transferring the transfer data to the buffer 11, the CPU 4 writes the value 11 indicating the number of bytes of the transfer data to the byte counter 12 (step S2). Then, the trigger 13 is set (step S3). When a transmission request is issued from the host computer 2 in a state where the trigger 13 is set, the communication control unit 14 buffers the transfer data of the number of bytes indicated by the byte counter 12 (11-byte transfer data). Data is sequentially read from the 11th head address. Then, the read transfer data is transmitted to the host computer 2 (steps S4 and S5). As a result, the 11-byte transfer data stored from the area 201 of the register R0 (20) to the area 223 of the register R2 (22) is transmitted to the host computer 2.

【0042】 上記した転送用データをバッファ11に転送するためのプログラム(ステップ S1のブロック転送のためのプログラム)は、アセンブラレベルでは、以下に示 すようになる。まず、レジスタR4(24)に、バッファ11の先頭アドレスを 示す値を記憶させるための命令(ステップS7)を記述する。そして、レジスタ R4(24)を転送先の先頭アドレスを示すポインタとして、レジスタR0(2 0)〜レジスタR3(23)に記憶された4ワードのデータを転送するブロック 転送命令(ステップS8)を記述する。この2命令の記述により、転送用データ をバッファ11に転送するためのプログラムが完成することになる。A program for transferring the above-described transfer data to the buffer 11 (a program for block transfer in step S1) is as follows at an assembler level. First, an instruction (step S7) for storing a value indicating the head address of the buffer 11 in the register R4 (24) is described. Then, a block transfer instruction (step S8) for transferring data of four words stored in the registers R0 (20) to R3 (23) is described using the register R4 (24) as a pointer indicating the start address of the transfer destination. I do. By the description of these two instructions, a program for transferring the transfer data to the buffer 11 is completed.

【0043】 なお、転送用データのバイト数が、例えば、8バイトである場合には、レジス タR0(20)のエリア201から、レジスタR1(21)のエリア214まで の範囲に、転送用データが準備される。そして、レジスタR2(22)とレジス タR3(23)の内容は無視される。この状態において、レジスタR0(20) のエリア201から、レジスタR3(23)のエリア234までの16バイトの データが、バッファ11に転送される。また、バイトカウンタ12には、値8が 書き込まれる。このため、通信制御部14は、バッファ11の先頭アドレスから 8バイト分のデータを、ホストコンピュータ2に送信する。When the number of bytes of the transfer data is, for example, 8 bytes, the transfer data ranges from the area 201 of the register R0 (20) to the area 214 of the register R1 (21). Is prepared. Then, the contents of the registers R2 (22) and R3 (23) are ignored. In this state, 16-byte data from the area 201 of the register R0 (20) to the area 234 of the register R3 (23) is transferred to the buffer 11. The value 8 is written to the byte counter 12. Therefore, the communication control unit 14 transmits eight bytes of data from the head address of the buffer 11 to the host computer 2.

【0044】 また、転送用データのバイト数が、例えば、16バイトである場合には、レジ スタR0(20)のエリア201から、レジスタR3(23)のエリア234ま での範囲に、転送用データが準備される。この状態において、レジスタR0(2 0)のエリア201から、レジスタR3(23)のエリア234までの16バイ トのデータが、バッファ11に転送される。また、バイトカウンタ12には、値 16が書き込まれる。このため、通信制御部14は、バッファ11の先頭アドレ スから16バイト分のデータを、ホストコンピュータ2に送信する。If the number of bytes of the transfer data is, for example, 16 bytes, the transfer data is transferred from the area 201 of the register R0 (20) to the area 234 of the register R3 (23). Data is prepared. In this state, 16 bytes of data from the area 201 of the register R0 (20) to the area 234 of the register R3 (23) are transferred to the buffer 11. The value 16 is written to the byte counter 12. For this reason, the communication control unit 14 transmits 16 bytes of data from the head address of the buffer 11 to the host computer 2.

【0045】 以上説明したように、上記した転送動作は、転送用データのバイト数を判別す る手順が不要な動作となっている。また、転送用データのバイト数がどのような 値となるときにも、1バイトのデータの転送が発生しない動作となっている。こ のため、バッファ11に転送用データを転送するプログラムの手順が簡単化され ることになる。As described above, the transfer operation described above does not require a procedure for determining the number of bytes of transfer data. Also, no matter what value the number of bytes of transfer data takes, the operation is such that transfer of 1-byte data does not occur. Therefore, the procedure of the program for transferring the transfer data to the buffer 11 is simplified.

【0046】 また、1ワードつづのデータを4回転送するのみで、転送用データをバッファ 11に転送する動作が終了する。その結果、CPU4のスループットが向上する ので、CPU4を、その他の作業に、より多く振り当てることができる。Further, the operation of transferring the data for transfer to the buffer 11 is completed only by transferring the data of one word at a time four times. As a result, the throughput of the CPU 4 is improved, so that the CPU 4 can be allocated more to other tasks.

【0047】 また、アセンブラレベルにおいて、上記した2つの命令を記述するのみで、転 送用データをバッファ11に転送するためのプログラムが記述される。すなわち 、転送用データをバッファ11に転送するためのプログラムを、アセンブラレベ ルで記述するときには、そのプログラムが短くなる。At the assembler level, a program for transferring the transfer data to the buffer 11 is described only by describing the above two instructions. That is, when a program for transferring the transfer data to the buffer 11 is described at the assembler level, the program is shortened.

【0048】 以上で、転送用データをバッファ11に転送するときの動作説明を終了し、以 下に補足的な動作について説明する。いま、ホストコンピュータ2から印字デー タが送信され、通信制御部14によって受信されたとする。このときでは、CP U4は、印字部7を制御することによって、ホストコンピュータ2から送信され た印字データを、印字用紙に印字する。The description of the operation when transferring the transfer data to the buffer 11 has been completed, and a supplementary operation will be described below. Now, it is assumed that print data is transmitted from the host computer 2 and received by the communication control unit 14. At this time, the CPU 4 controls the printing unit 7 to print the print data transmitted from the host computer 2 on printing paper.

【0049】 なお、本考案は上記実施形態に限定されず、バッファ11については、16バ イトとした場合について説明したが、4バイトの整数倍であるならば、任意のバ イト数とすることが可能になっている。Note that the present invention is not limited to the above embodiment, and the case where the buffer 11 has 16 bytes has been described. However, if the buffer 11 is an integral multiple of 4 bytes, the buffer 11 may have an arbitrary number of bytes. Has become possible.

【0050】 また、転送用データを含む16バイトのデータを、バッファ11にブロック転 送するときの命令については、レジスタR4(24)をポインタとして使用する 命令を用いた場合について説明したが、転送先のアドレスをイミーディエット値 として指定することが可能である場合には、この命令を用いることも可能である 。また、その他の任意のアドレッシングモードによるブロック転送の命令を使用 することも可能である。The instruction for block-transferring 16-byte data including the transfer data to the buffer 11 has been described in the case where the instruction using the register R4 (24) as a pointer is used. This instruction can be used if the previous address can be specified as an immediate value. It is also possible to use a block transfer instruction in any other addressing mode.

【0051】[0051]

【考案の効果】[Effect of the invention]

以上説明したように、本考案に係る電子装置は、nを自然数とするとき、デー タ量が2nバイト以下の範囲で変化する転送用データを一時記憶すると共に、そ のデータエリアが2nバイトに固定されたバッファと、転送用データのバイト数 が書き込まれるバイトカウンタと、所定エリアに格納された転送用データを前記 バッファに転送すると共に、前記バッファに転送用データを転送するときのデー タ幅が2の累乗バイトである転送手段とを備えた構成において、前記転送手段は 、転送用データを前記バッファに転送するときには、転送用データのバイト数が 2nバイトより少なくなるときにも、転送用データを含む2nバイトのデータを 前記バッファに転送すると共に、バイトカウンタには転送用データのバイト数を 書き込む構成としている。従って、転送手段は、転送用データのバイト数に関わ りなく、バッファには、常に2nバイトのデータを転送する。このため、転送用 データのバイト数がどのような値となるときにも、手順が複雑となる1バイトの データ転送が発生しないので、バッファにデータを転送するプログラムの手順を 簡単化することが可能になっている。 As described above, the electronic device according to the present invention, when n is a natural number, temporarily stores transfer data whose data amount changes within a range of 2n bytes or less, and its data area is reduced to 2n bytes. A fixed buffer, a byte counter in which the number of bytes of transfer data is written, and a data width for transferring the transfer data stored in a predetermined area to the buffer and transferring the transfer data to the buffer. Is a power-of-two byte, the transfer means transfers the transfer data to the buffer even when the number of bytes of the transfer data is less than 2n bytes. 2n bytes of data including data is transferred to the buffer, and the number of bytes of the transfer data is written in the byte counter. To have. Therefore, the transfer means always transfers 2n bytes of data to the buffer, regardless of the number of bytes of the transfer data. For this reason, no matter what the number of bytes of data to be transferred is, no one-byte data transfer, which complicates the procedure, occurs, so that the procedure of the program for transferring data to the buffer can be simplified. It is possible.

【0052】 また、さらに、前記バッファのデータエリアを4バイトの整数倍とし、前記転 送手段は、4バイトのデータを一度に書き込む書込命令の実行機能を備えた構成 としている。従って、バッファのデータエリアのバイト数の1/4の値をYとす ると、転送手段が、バッファにY回のデータ転送を行うのみで、転送用データの 転送が終了するため、バッファへのデータ転送に要する時間を短縮することが可 能になっている。Further, the data area of the buffer is an integral multiple of 4 bytes, and the transfer means has a function of executing a write command for writing 4-byte data at a time. Therefore, if the value of 1/4 of the number of bytes in the data area of the buffer is Y, the transfer means only transfers the data to the buffer Y times, and the transfer of the transfer data ends. It is possible to reduce the time required for data transfer.

【0053】 また、さらに、4バイトのデータをワードとするとき、前記転送手段は、複数 ワードのデータ転送を1命令で指示するブロック転送命令の実行機能を備えた構 成としている。従って、アセンブラレベルの1つの命令によって、バッファに転 送用データを転送する動作を記述することができるので、データの転送手順を示 すアセンブラレベルの命令の命令数を低減することが可能になっている。Further, when 4-byte data is converted into a word, the transfer means is configured to have a function of executing a block transfer instruction instructing data transfer of a plurality of words by one instruction. Therefore, the operation of transferring the transfer data to the buffer can be described by one assembler-level instruction, so that the number of assembler-level instructions indicating the data transfer procedure can be reduced. ing.

【0054】 また、さらに、前記バッファに転送された転送用データを、USBを介してホ ストコンピュータに送信する通信制御部を備えた構成としている。従って、US Bを介して接続されたホストコンピュータに送信するデータをバッファに準備す るときの手順を簡単化することが可能になっている。Further, a communication control unit for transmitting the transfer data transferred to the buffer to the host computer via USB is provided. Therefore, it is possible to simplify the procedure for preparing data to be transmitted to the host computer connected via the USB in the buffer.

【0055】 また、さらに、前記USBを介してホストコンピュータから受信した印字デー タを印字するプリンタとしている。すなわち、USBを介して接続されたホスト コンピュータからの印字データを印字するプリンタにおいては、ホストコンピュ ータに送信するデータをバッファに準備するときの手順が簡単化されるので、ホ ストコンピュータにデータを送信するときの手順を簡単化することのできるプリ ンタが提供されることになる。Further, the printer is configured to print the print data received from the host computer via the USB. That is, in a printer that prints print data from a host computer connected via USB, the procedure for preparing data to be transmitted to the host computer in a buffer is simplified, and the data is stored in the host computer. A printer that can simplify the procedure for sending a message is provided.

【図面の簡単な説明】[Brief description of the drawings]

【図1】本考案に係る電子装置の一実施形態(プリン
タ)の電気的構成を示すブロック線図である。
FIG. 1 is a block diagram showing an electrical configuration of an embodiment (printer) of an electronic device according to the present invention.

【図2】転送用データをホストコンピュータに送信する
ときの主要動作を示すフローチャートである。
FIG. 2 is a flowchart illustrating main operations when transmitting transfer data to a host computer.

【図3】転送用データをバッファに転送する動作を、ア
センブラレベルで示すフローチャートである。
FIG. 3 is a flowchart showing an operation of transferring transfer data to a buffer at an assembler level.

【図4】CPU内のレジスタR0〜R3の状態を示す説
明図である。
FIG. 4 is an explanatory diagram showing states of registers R0 to R3 in a CPU.

【図5】従来技術の転送手順を示すフローチャートであ
る。
FIG. 5 is a flowchart illustrating a transfer procedure according to the related art.

【符号の説明】[Explanation of symbols]

1 プリンタ 2 ホストコンピュータ 3 転送手段 4 CPU 11 バッファ 12 バイトカウンタ 14 通信制御部 15 通信部 17 USBケーブル 20〜24 レジスタ Reference Signs List 1 printer 2 host computer 3 transfer means 4 CPU 11 buffer 12 byte counter 14 communication control unit 15 communication unit 17 USB cable 20 to 24 register

Claims (5)

【実用新案登録請求の範囲】[Utility model registration claims] 【請求項1】 nを自然数とするとき、データ量が2n
バイト以下の範囲で変化する転送用データを一時記憶す
ると共に、そのデータエリアが2nバイトに固定された
バッファと、転送用データのバイト数が書き込まれるバ
イトカウンタと、所定エリアに格納された転送用データ
を前記バッファに転送すると共に、前記バッファに転送
用データを転送するときのデータ幅が2の累乗バイトで
ある転送手段とを備えた電子装置において、 前記転送手段は、転送用データを前記バッファに転送す
るときには、転送用データのバイト数が2nバイトより
少なくなるときにも、転送用データを含む2nバイトの
データを前記バッファに転送すると共に、バイトカウン
タには転送用データのバイト数を書き込むことを特徴と
する電子装置。
When n is a natural number, the data amount is 2n
A buffer having a data area fixed at 2n bytes, a byte counter in which the number of bytes of the transfer data is written, and a transfer counter stored in a predetermined area. Transfer means for transferring data to the buffer and transferring the transfer data to the buffer, wherein the transfer means has a data width of a power of 2 bytes, wherein the transfer means stores the transfer data in the buffer. When the number of bytes of the transfer data is smaller than 2n bytes, 2n bytes of data including the transfer data is transferred to the buffer and the number of bytes of the transfer data is written in the byte counter. An electronic device, comprising:
【請求項2】 前記バッファのデータエリアを4バイト
の整数倍とし、前記転送手段は、4バイトのデータを一
度に書き込む書込命令の実行機能を備えていることを特
徴とする請求項1記載の電子装置。
2. The data area of the buffer is an integral multiple of 4 bytes, and the transfer means has a function of executing a write command for writing 4-byte data at a time. Electronic devices.
【請求項3】 4バイトのデータをワードとするとき、 前記転送手段は、複数ワードのデータ転送を1命令で指
示するブロック転送命令の実行機能を備えていることを
特徴とする請求項2記載の電子装置。
3. The transfer means according to claim 2, wherein when 4-byte data is converted into a word, said transfer means has a function of executing a block transfer instruction instructing data transfer of a plurality of words by one instruction. Electronic devices.
【請求項4】 前記バッファに転送された転送用データ
を、USBを介してホストコンピュータに送信する通信
制御部を備えたことを特徴とする請求項1から請求項3
までのいずれかに記載の電子装置。
4. The communication apparatus according to claim 1, further comprising a communication control unit for transmitting the transfer data transferred to said buffer to a host computer via a USB.
The electronic device according to any of the above.
【請求項5】 前記USBを介してホストコンピュータ
から受信した印字データを印字するプリンタであること
を特徴とする請求項4記載の電子装置。
5. The electronic device according to claim 4, wherein the printer is a printer that prints print data received from a host computer via the USB.
JP1999009710U 1999-12-22 1999-12-22 Electronic equipment Expired - Lifetime JP3069867U (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP1999009710U JP3069867U (en) 1999-12-22 1999-12-22 Electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP1999009710U JP3069867U (en) 1999-12-22 1999-12-22 Electronic equipment

Publications (1)

Publication Number Publication Date
JP3069867U true JP3069867U (en) 2000-07-04

Family

ID=43203297

Family Applications (1)

Application Number Title Priority Date Filing Date
JP1999009710U Expired - Lifetime JP3069867U (en) 1999-12-22 1999-12-22 Electronic equipment

Country Status (1)

Country Link
JP (1) JP3069867U (en)

Similar Documents

Publication Publication Date Title
US6967960B1 (en) Method and apparatus for emulating a local data port
US6397316B2 (en) System for reducing bus overhead for communication with a network interface
CN107967225B (en) Data transmission method and device, computer readable storage medium and terminal equipment
KR100228793B1 (en) Data processing method for printer
CN107256134B (en) Method and device for virtualizing POS terminal as computer printer and POS terminal
JP2000158724A (en) Image-processing apparatus, image processing method and recording medium
US6856420B1 (en) System and method for transferring data within a printer
JP3069867U (en) Electronic equipment
JPH10334037A (en) Communication dma device
JP2008502977A (en) Interrupt method for bus controller
EP0690382B1 (en) Computer system with a multiplexed address bus and pipelined write operations
JP3261233B2 (en) Printing apparatus and processing method
US7187385B2 (en) Image processing apparatus
JP2000148663A (en) Dma device and image forming device using the dma device
JP4890681B2 (en) Image processing device
JP4329188B2 (en) Data transfer control device
JPH1021019A (en) Printer device
CN110399322B (en) Data transmission method and ping-pong DMA framework
JP2658931B2 (en) Printer controller
JP3700410B2 (en) Printer system and print control method
JP2999662B2 (en) Print control device and print control method
JP2002517820A (en) Compression and decompression of serial port data and status using direct memory access
KR100538219B1 (en) Virtual memory management method for printer using memory of host computer
JPH05224843A (en) Control method for printer
JP2002292943A (en) Printer and data transfer method in printer