Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Smart Card Programming_FULL documentation Provided

Status
Not open for further replies.

PredAlien

Newbie level 6
Joined
Sep 8, 2004
Messages
14
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,281
Activity points
180
Hi all

i have pic simulator called "PIC SIMULATOR IDE"
i have 2 computers connected in serially
and i just want to send a message across to the other computer, by using pic basic lauguage by using the following code,

SEROUT PORTB.6, 9600, "HELLO WORLD"

am i doing anything wrong here
the serial cable is working 100%, iv tested it by sending messages across with the acutall built in serial communication terminal with in the simultor, but when i simulate this line of code, nothing seem to happen, please help me, iv trying things for hours, and i dont know wot to do :cry:


This topic is merged with another one about smart cards
/Cluricaun
 

FoxyRick

Advanced Member level 4
Joined
Jan 8, 2004
Messages
1,249
Helped
321
Reputation
640
Reaction score
277
Trophy points
1,363
Location
England, UK
Activity points
12,978
Re: Serial Communication With PIC _need ur help

I'm not sure that it can do this. Yes, you can use the "PC Serial Port Terminal" to talk to the PC's port, but I don't think that the simulator uses the PC's serial port when simulating code.

PICSim has, under the tools menu, tools to interact with the PIC's hardware and software serial ports during simulation. If you are using SEROUT, I assume software uart, so choose "tools/Software uart simulation interface" to see what is being sent.

I might be wrong, but I really don't think that simulated serial port data is echoed to the PC's serial port. Would be nice though if it is...

FoxyRick.
 

PredAlien

Newbie level 6
Joined
Sep 8, 2004
Messages
14
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,281
Activity points
180
Re: Serial Communication With PIC _need ur help

thing is if go to tools then select "PC's serial terminal" on both computers, and send text to each other, this will work via serial cable would have to be connected ofcourse, However when i right a simple code like
SEROUT PORTB1, 9600,[HELLO WORLD]
and then complie,assembel then load the program in the pic simulator ide, and select the simulator key, and simulate, i dont see "hello world" on the other computer, am i doing the wrong thing, or is there somthing im surpose to add or somthing, please i really need ur guys help :(
 

PredAlien

Newbie level 6
Joined
Sep 8, 2004
Messages
14
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,281
Activity points
180
SmartCard Programming_Pic Baisc Pro_TCL_Schamatic

iv got a Gold wafer smartcard and a programming device called (Smartcard Phoenix ) which programs both the pic 16f84a and the eeprom 24c14.

the problem is, when i use ic-prog to do a blank check, it say "Device NOT blank at address 0000h ! "

what should i do , i dont know what to do, i mean i erased the whole card by pressing the erase all button, and still this thing keeps poping up when i do a blank check, please help :(
 

SPATAN

Full Member level 2
Joined
Aug 17, 2004
Messages
135
Helped
8
Reputation
16
Reaction score
3
Trophy points
1,298
Activity points
1,021
Re: Serial Communication With PIC _need ur help

You can check X-TAL and include file ( include serial modes )

INCLUDE "modedefs.bas" ' Include serial modes

SO VAR PORTC.6 ' Define serial output pin
DEFINE OSC 10

serout SO,T9600,[12,"HELLO WORLD",10,13]
 

zmanultra

Member level 2
Joined
Mar 20, 2004
Messages
48
Helped
4
Reputation
8
Reaction score
2
Trophy points
1,288
Location
Australia
Activity points
524
Re: Smart Card Programming

hi there

it seem to be not even reading your card for some reason, check your serial port, and the ic-prog setting, cause the error code that you are geting means that its not even reaching in the card hence 0000 is the start address and "h" is only to specify that 0000 is in hex etc. im not sure what else to say.

i hope some one can help you, im just like you a starter in the smartcard programming.

good luck anyway
 

    PredAlien

    Points: 2
    Helpful Answer Positive Rating

zmanultra

Member level 2
Joined
Mar 20, 2004
Messages
48
Helped
4
Reputation
8
Reaction score
2
Trophy points
1,288
Location
Australia
Activity points
524
Re: Serial Communication With PIC _need ur help

serout SO,T9600,[12,"HELLO WORLD",10,13]

what dose the 12,10,13 do
 

pixel

Advanced Member level 2
Joined
Sep 16, 2004
Messages
511
Helped
69
Reputation
138
Reaction score
16
Trophy points
1,298
Activity points
3,992
Re: Serial Communication With PIC _need ur help

10,and 13 are lline feed and return ACSII characters. They are used when you want to print Hello World string in new coulmn.
 

zmanultra

Member level 2
Joined
Mar 20, 2004
Messages
48
Helped
4
Reputation
8
Reaction score
2
Trophy points
1,288
Location
Australia
Activity points
524
Smart Card Programming + schamtic

Hi every one

iv been having probloms trying to talk to the smartcard, iv managed to program it with the following code through ic-prog.
"the following is in pic basic pro complied in microcode studio which uses pic basic pro as a compiler and and mpasm as an assembler"


-----------------------------------------------------------------------
' SERIN & SEROUT Commands
'
' Upper case serial filter.
Include "modedefs.bas" ' Include serial modes

SO con 0 ' Define serial out pin
SI con 1 ' Define serial in pin
B0 var byte

loop: Serin SI,T9600,B0 ' B0 = input character
If (B0 < "a") or (B0 > "z") Then print ' If lower case, convert to upper
B0 = B0 - $20
print: Serout SO,T9600,[B0] ' Send character
Goto loop
---------------------------------------------------------------------------------


i then got the hex file, and transmitted it into the goldwafer smartcard,

what that routine{above} actaully do is that it just accepts a letter from the key board, and then change that into capital letter and send it back serially i.e. from the I/O of the pic processor pin13/portb.7

Having the card inside the reader, programmed and waiting (i think its wating) :?: i right a simple routine in "tcl" to just send a letter and recive the answer from the serial port:


-------------------------------------
set serial [open com1 r+]
fconfigure $serial -mode "9600,n,8,1" -ttycontrol {RTS 0}
fconfigure $serial -blocking 0 -buffering line

puts $serial "a"
set data [read $serial]
puts "$data"
-----------------------------------------

please help me, i really need help, i dont know what to do, im not doing this correctley please tell me what you know, anything can help :( :( :( [/i]
 

    PredAlien

    Points: 2
    Helpful Answer Positive Rating

psubiaco

Member level 2
Joined
Apr 6, 2003
Messages
42
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,286
Location
Italy
Activity points
610
Re: SmartCard Programming_Pic Baisc Pro_TCL_Schamatic

Here is a piece of TCL code to use COM port in both Linux and Windows (I've not tried other platforms).

Code:
set DOS_COMPORT   COM1
set UNIX_DEVICE   /dev/ttyS0

if [string equal -nocase $tcl_platform(platform) {windows}] {
  set comport $DOS_COMPORT
} else {
  set comport $UNIX_DEVICE
}

if { [catch {open $comport {r+}} fdin] } {
  printLog "Error opening serial port $comport"
  after 2000
  exit
}
fconfigure $fdin -mode 38400,n,8,1 -blocking 0 -translation binary -buffering none

Then, puts $fdin "a"; flush $fdin should be ok to TX data....
Take care to the binary conversion of data, if you need binary transfers, using somthing like
puts -nonewline $fdin [binary format c $ch]

To read binary data,
if {[catch {read $fdin $linelen} line]} {
if {$timeout==0} {return -2}
after 2
continue
} elseif {[binary scan $line c value]==1} {
....

Regards. Paolo
 

PredAlien

Newbie level 6
Joined
Sep 8, 2004
Messages
14
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,281
Activity points
180
Re: Serial Communication With PIC _need ur help

HI All

iv put this code in the gold wafer smartcard : "coded in pic basic pro"

----------------------------------------------------------------------'
'Upper case serial filter.
Include "modedefs.bas" ' Include serial modes

SO con 0 ' Define serial out pin
SI con 1 ' Define serial in pin
B0 var byte

loop: Serin SI,T9600,B0 ' B0 = input character
If (B0 < "a") or (B0 > "z") Then print ' If lower case, convert to upper
B0 = B0 - $20
print: Serout SO,T9600,[B0] ' Send character
Goto loop ' Forever
-------------------------------------------------------------------------

then iv put it in smartmouse/phoenix mode,
then i sent a letter "a" to the comport 1 and then i read the answer but nothing happns PLEASE SOME ONE HELP ME i dont know what to do to get this to work, :cry:
 

Hai_Men

Junior Member level 2
Joined
Mar 31, 2003
Messages
22
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Malaysia
Activity points
264
Re: Serial Communication With PIC _need ur help

AFAIK,

The pic simulator only work within PIC envoroment. It can't go through your external peripheral (computer harware)
 

Iain

Advanced Member level 4
Joined
Jan 9, 2004
Messages
113
Helped
17
Reputation
34
Reaction score
10
Trophy points
1,298
Activity points
1,136
Serial Communication With PIC _need ur help

You could probably get this to fly within the Proteus simulation environment via the COMPIM model.

The COMPIM model is a Physical Interface Model of a serial port. Incoming serial data is buffered and presented to the circuit as a digital signal, whilst serial digital data generated by a CPU or UART model appears at the PC's physical COM port. The COMPIM model also provides for baud rate translation, and for optional hardware or software handshaking on both the physical and virtual sides of the device.
This allows any real world hardware equipped with a serial port to interact with a VSM simulation. For example, you could use it to develop a program for a microprocessor within Proteus VSM that would operate a real physical modem, perhaps as part of a security or home automation system. Alternatively, a monitor debugger running on one PC can be used to debug a simulated design running within VSM.

The COMPIM model can also be used for some simple digital I/O: the CTS, DSR, DCD and RI lines on the physical serial port can act as rudimentary digital inputs from external stimulus, such as switches; the RTS and DTR lines on the physical serial port can act as rudimentary outputs. Bear in mind that these signals may need addition physical signal conditioning, depending on application and port type.
 

PredAlien

Newbie level 6
Joined
Sep 8, 2004
Messages
14
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,281
Activity points
180
Re: Serial Communication With PIC _need ur help

After compiling, and aquiring the HEX file it is programmed into the card, by using the IC-prog program, then when the program in inside the card, the Actual programmer is switched from a pic progammer to phoenix/smartmouse mode, and only the I/O , CLK, RST and card detect signals are present.

i just cand figure out how to communicate with the smartcard, im going to give you guys the document of the opertation for the actuall programer, which is rare to find as well, here you go, please try to help, im in despreate help from you guys.
 

Fragrance

Advanced Member level 4
Joined
Jul 26, 2002
Messages
1,191
Helped
248
Reputation
496
Reaction score
200
Trophy points
1,343
Location
East Of Earth
Activity points
8,917
hi

here is smart card programmer made in proteus with simulation code written in pic basic pro, i also making other smart card models for proteus once completed i will share them here
 

PredAlien

Newbie level 6
Joined
Sep 8, 2004
Messages
14
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,281
Activity points
180
hi every one


-------------------------------------------------
SO var PortB.7
BAUD CON 84 '9600 baud, no parity, true, always driven

TRISB = %01111111 'PortB.7 serial-output pin
PORTB = $80

MAIN:
SEROUT2 SO,BAUD,["Hello World"]
PAUSE 400
GOTO MAIN

END
------------------------------------------------------------------------

why dose the smartcard dislplay this in serial communication output window:

˜ÅÜÜß@§ßâÜÄ

i dont get it :?
 

IranDVB

Newbie level 2
Joined
Jul 23, 2004
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
16
SmartCard Programming_Pic Baisc Pro_TCL_Schamatic

may Pic16f84A is configured to be locked after programming.
I had JDM programmer and Icprog . After configrating PIC to be lock you will get this error.
 

PredAlien

Newbie level 6
Joined
Sep 8, 2004
Messages
14
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,281
Activity points
180
Re: SmartCard Programming_Pic Baisc Pro_TCL_Schamatic

IranDVB said:
may Pic16f84A is configured to be locked after programming.
I had JDM programmer and Icprog . After configrating PIC to be lock you will get this error.

can you please tell me how to "Unblock" then, i really neva came acress this before, is it hte code protection you mean??
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top